All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.freedesktop.gstreamer.gst.BusFunc Maven / Gradle / Ivy

There is a newer version: 0.10.2
Show newest version
/* 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.*;

/**
 * Specifies the type of function passed to gst_bus_add_watch() or
 * gst_bus_add_watch_full(), which is called from the mainloop when a message
 * is available on the bus.
 * 

* The message passed to the function will be unreffed after execution of this * function so it should not be freed in the function. *

* Note that this function is used as a {@link org.gnome.glib.SourceFunc} which means that returning * {@code false} will remove the {@link org.gnome.glib.Source} from the mainloop. */ @FunctionalInterface public interface BusFunc { /** * Specifies the type of function passed to gst_bus_add_watch() or * gst_bus_add_watch_full(), which is called from the mainloop when a message * is available on the bus. *

* The message passed to the function will be unreffed after execution of this * function so it should not be freed in the function. *

* Note that this function is used as a {@link org.gnome.glib.SourceFunc} which means that returning * {@code false} will remove the {@link org.gnome.glib.Source} from the mainloop. */ boolean run(org.freedesktop.gstreamer.gst.Bus bus, org.freedesktop.gstreamer.gst.Message message); /** * The {@code upcall} method is called from native code. The parameters * are marshalled and {@link #run} is executed. */ @ApiStatus.Internal default int upcall(MemorySegment bus, MemorySegment message, MemorySegment userData) { var _result = run((org.freedesktop.gstreamer.gst.Bus) InstanceCache.getForType(bus, org.freedesktop.gstreamer.gst.Bus::new, false), MemorySegment.NULL.equals(message) ? null : new org.freedesktop.gstreamer.gst.Message(message)); return _result ? 1 : 0; } /** * 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(), BusFunc.class, _fdesc); return Linker.nativeLinker().upcallStub(_handle.bindTo(this), _fdesc, arena); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy