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

org.freedesktop.gstreamer.gst.Query 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.*;

/**
 * Queries can be performed on pads (gst_pad_query()) and elements
 * (gst_element_query()). Please note that some queries might need a running
 * pipeline to work.
 * 

* Queries can be created using the gst_query_new_*() functions. * Query values can be set using gst_query_set_*(), and parsed using * gst_query_parse_*() helpers. *

* The following example shows how to query the duration of a pipeline: *

{@code 
 *   GstQuery *query;
 *   gboolean res;
 *   query = gst_query_new_duration (GST_FORMAT_TIME);
 *   res = gst_element_query (pipeline, query);
 *   if (res) {
 *     gint64 duration;
 *     gst_query_parse_duration (query, NULL, &duration);
 *     g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
 *   } else {
 *     g_print ("duration query failed...");
 *   }
 *   gst_query_unref (query);
 * }
*/ public class Query extends ManagedInstance { static { Gst.javagi$ensureInitialized(); } /** * Get the GType of the GstQuery class. * @return the GType */ public static org.gnome.glib.Type getType() { return Interop.getType("gst_query_get_type"); } /** * The memory layout of the native struct. * @return the memory layout */ public static MemoryLayout getMemoryLayout() { return MemoryLayout.structLayout( org.freedesktop.gstreamer.gst.MiniObject.getMemoryLayout().withName("mini_object"), ValueLayout.JAVA_INT.withName("type") ).withName("GstQuery"); } /** * Allocate a new {@link Query}. * * @param arena to control the memory allocation scope. * @return A new, uninitialized {@link Query} */ public static Query allocate(Arena arena) { MemorySegment segment = arena.allocate(getMemoryLayout()); return new Query(segment); } /** * Allocate a new {@link Query}. A {@link java.lang.ref.Cleaner} * is assigned to the allocated memory segment that will release the * memory when the {@link Query} instance is garbage-collected. * * @return A new, uninitialized {@link Query} * @deprecated See {@link #allocate(Arena)} */ @Deprecated public static Query allocate() { return Query.allocate(Arena.ofAuto()); } /** * Allocate a new {@link Query} with the fields set to the provided values. * A {@link java.lang.ref.Cleaner} is assigned to the allocated memory segment that will * release the memory when the {@link Query} instance is garbage-collected. * * @param miniObject value for the field {@code miniObject} * @param type value for the field {@code type} * @return A new {@link Query} with the fields set to the provided values * @deprecated See {@link #allocate(Arena, org.freedesktop.gstreamer.gst.MiniObject, org.freedesktop.gstreamer.gst.QueryType)} */ @Deprecated public static Query allocate(org.freedesktop.gstreamer.gst.MiniObject miniObject, org.freedesktop.gstreamer.gst.QueryType type) { return allocate(Arena.ofAuto(), miniObject, type); } /** * Allocate a new {@link Query} with the fields set to the provided values. * * @param arena to control the memory allocation scope. * @param miniObject value for the field {@code miniObject} * @param type value for the field {@code type} * @return A new {@link Query} with the fields set to the provided values */ public static Query allocate(Arena arena, org.freedesktop.gstreamer.gst.MiniObject miniObject, org.freedesktop.gstreamer.gst.QueryType type) { Query _instance = allocate(arena); _instance.writeMiniObject(miniObject); _instance.writeType(type); return _instance; } /** * Read the value of the field {@code mini_object} * @return The value of the field {@code mini_object} */ public org.freedesktop.gstreamer.gst.MiniObject readMiniObject() { long _offset = getMemoryLayout().byteOffset(MemoryLayout.PathElement.groupElement("mini_object")); return MemorySegment.NULL.equals(handle().asSlice(_offset)) ? null : new org.freedesktop.gstreamer.gst.MiniObject(handle().asSlice(_offset)); } /** * Write a value in the field {@code mini_object} * @param miniObject The new value for the field {@code mini_object} */ public void writeMiniObject(org.freedesktop.gstreamer.gst.MiniObject miniObject) { getMemoryLayout() .varHandle(MemoryLayout.PathElement.groupElement("mini_object")) .set(handle(), (miniObject == null ? MemorySegment.NULL : miniObject.handle())); } /** * Read the value of the field {@code type} * @return The value of the field {@code type} */ public org.freedesktop.gstreamer.gst.QueryType readType() { var _result = (int) getMemoryLayout() .varHandle(MemoryLayout.PathElement.groupElement("type")) .get(handle()); return org.freedesktop.gstreamer.gst.QueryType.of(_result); } /** * Write a value in the field {@code type} * @param type The new value for the field {@code type} */ public void writeType(org.freedesktop.gstreamer.gst.QueryType type) { getMemoryLayout() .varHandle(MemoryLayout.PathElement.groupElement("type")) .set(handle(), type.getValue()); } /** * Create a Query proxy instance for the provided memory address. * @param address the memory address of the native object */ public Query(MemorySegment address) { super(address == null ? null : Interop.reinterpret(address, getMemoryLayout().byteSize())); MemoryCleaner.setFreeFunc(this.handle(), "gst_query_unref"); } /** * Constructs a new query object for querying if {@code caps} are accepted. *

* Free-function: gst_query_unref() * @param caps a fixed {@link Caps} * @return a new {@link Query} */ public static Query acceptCaps(org.freedesktop.gstreamer.gst.Caps caps) { var _result = constructAcceptCaps(caps); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying if {@code caps} are accepted. *

* Free-function: gst_query_unref() * @param caps a fixed {@link Caps} * @return a new {@link Query} * @deprecated See {@link #acceptCaps} */ @Deprecated public static Query newAcceptCaps(org.freedesktop.gstreamer.gst.Caps caps) { var _result = constructAcceptCaps(caps); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_accept_caps} constructor */ private static MemorySegment constructAcceptCaps(org.freedesktop.gstreamer.gst.Caps caps) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_accept_caps", _fdesc, false).invokeExact((MemorySegment) (caps == null ? MemorySegment.NULL : caps.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the allocation properties. *

* Free-function: gst_query_unref() * @param caps the negotiated caps * @param needPool return a pool * @return a new {@link Query} */ public static Query allocation(@Nullable org.freedesktop.gstreamer.gst.Caps caps, boolean needPool) { var _result = constructAllocation(caps, needPool); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the allocation properties. *

* Free-function: gst_query_unref() * @param caps the negotiated caps * @param needPool return a pool * @return a new {@link Query} * @deprecated See {@link #allocation} */ @Deprecated public static Query newAllocation(@Nullable org.freedesktop.gstreamer.gst.Caps caps, boolean needPool) { var _result = constructAllocation(caps, needPool); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_allocation} constructor */ private static MemorySegment constructAllocation(@Nullable org.freedesktop.gstreamer.gst.Caps caps, boolean needPool) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_allocation", _fdesc, false).invokeExact((MemorySegment) (caps == null ? MemorySegment.NULL : caps.handle()), needPool ? 1 : 0); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the bitrate. *

* Free-function: gst_query_unref() * @return a new {@link Query} */ public static Query bitrate() { var _result = constructBitrate(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the bitrate. *

* Free-function: gst_query_unref() * @return a new {@link Query} * @deprecated See {@link #bitrate} */ @Deprecated public static Query newBitrate() { var _result = constructBitrate(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_bitrate} constructor */ private static MemorySegment constructBitrate() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_bitrate", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the buffering status of * a stream. *

* Free-function: gst_query_unref() * @param format the default {@link Format} for the new query * @return a new {@link Query} */ public static Query buffering(org.freedesktop.gstreamer.gst.Format format) { var _result = constructBuffering(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the buffering status of * a stream. *

* Free-function: gst_query_unref() * @param format the default {@link Format} for the new query * @return a new {@link Query} * @deprecated See {@link #buffering} */ @Deprecated public static Query newBuffering(org.freedesktop.gstreamer.gst.Format format) { var _result = constructBuffering(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_buffering} constructor */ private static MemorySegment constructBuffering(org.freedesktop.gstreamer.gst.Format format) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_buffering", _fdesc, false).invokeExact(format.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the caps. *

* The CAPS query should return the allowable caps for a pad in the context * of the element's state, its link to other elements, and the devices or files * it has opened. These caps must be a subset of the pad template caps. In the * NULL state with no links, the CAPS query should ideally return the same caps * as the pad template. In rare circumstances, an object property can affect * the caps returned by the CAPS query, but this is discouraged. *

* For most filters, the caps returned by CAPS query is directly affected by the * allowed caps on other pads. For demuxers and decoders, the caps returned by * the srcpad's getcaps function is directly related to the stream data. Again, * the CAPS query should return the most specific caps it reasonably can, since this * helps with autoplugging. *

* The {@code filter} is used to restrict the result caps, only the caps matching * {@code filter} should be returned from the CAPS query. Specifying a filter might * greatly reduce the amount of processing an element needs to do. *

* Free-function: gst_query_unref() * @param filter a filter * @return a new {@link Query} */ public static Query caps(org.freedesktop.gstreamer.gst.Caps filter) { var _result = constructCaps(filter); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the caps. *

* The CAPS query should return the allowable caps for a pad in the context * of the element's state, its link to other elements, and the devices or files * it has opened. These caps must be a subset of the pad template caps. In the * NULL state with no links, the CAPS query should ideally return the same caps * as the pad template. In rare circumstances, an object property can affect * the caps returned by the CAPS query, but this is discouraged. *

* For most filters, the caps returned by CAPS query is directly affected by the * allowed caps on other pads. For demuxers and decoders, the caps returned by * the srcpad's getcaps function is directly related to the stream data. Again, * the CAPS query should return the most specific caps it reasonably can, since this * helps with autoplugging. *

* The {@code filter} is used to restrict the result caps, only the caps matching * {@code filter} should be returned from the CAPS query. Specifying a filter might * greatly reduce the amount of processing an element needs to do. *

* Free-function: gst_query_unref() * @param filter a filter * @return a new {@link Query} * @deprecated See {@link #caps} */ @Deprecated public static Query newCaps(org.freedesktop.gstreamer.gst.Caps filter) { var _result = constructCaps(filter); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_caps} constructor */ private static MemorySegment constructCaps(org.freedesktop.gstreamer.gst.Caps filter) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_caps", _fdesc, false).invokeExact((MemorySegment) (filter == null ? MemorySegment.NULL : filter.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the pipeline-local context. *

* Free-function: gst_query_unref() * @param contextType Context type to query * @return a new {@link Query} */ public static Query context(java.lang.String contextType) { var _result = constructContext(contextType); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the pipeline-local context. *

* Free-function: gst_query_unref() * @param contextType Context type to query * @return a new {@link Query} * @deprecated See {@link #context} */ @Deprecated public static Query newContext(java.lang.String contextType) { var _result = constructContext(contextType); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_context} constructor */ private static MemorySegment constructContext(java.lang.String contextType) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_context", _fdesc, false).invokeExact((MemorySegment) (contextType == null ? MemorySegment.NULL : Interop.allocateNativeString(contextType, _arena))); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } } /** * Constructs a new convert query object. Use gst_query_unref() * when done with it. A convert query is used to ask for a conversion between * one format and another. *

* Free-function: gst_query_unref() * @param srcFormat the source {@link Format} for the new query * @param value the value to convert * @param destFormat the target {@link Format} * @return a {@link Query} */ public static Query convert(org.freedesktop.gstreamer.gst.Format srcFormat, long value, org.freedesktop.gstreamer.gst.Format destFormat) { var _result = constructConvert(srcFormat, value, destFormat); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new convert query object. Use gst_query_unref() * when done with it. A convert query is used to ask for a conversion between * one format and another. *

* Free-function: gst_query_unref() * @param srcFormat the source {@link Format} for the new query * @param value the value to convert * @param destFormat the target {@link Format} * @return a {@link Query} * @deprecated See {@link #convert} */ @Deprecated public static Query newConvert(org.freedesktop.gstreamer.gst.Format srcFormat, long value, org.freedesktop.gstreamer.gst.Format destFormat) { var _result = constructConvert(srcFormat, value, destFormat); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_convert} constructor */ private static MemorySegment constructConvert(org.freedesktop.gstreamer.gst.Format srcFormat, long value, org.freedesktop.gstreamer.gst.Format destFormat) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_convert", _fdesc, false).invokeExact(srcFormat.getValue(), value, destFormat.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new custom query object. Use gst_query_unref() * when done with it. *

* Free-function: gst_query_unref() * @param type the query type * @param structure a structure for the query * @return a new {@link Query} */ public static Query custom(org.freedesktop.gstreamer.gst.QueryType type, @Nullable org.freedesktop.gstreamer.gst.Structure structure) { var _result = constructCustom(type, structure); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new custom query object. Use gst_query_unref() * when done with it. *

* Free-function: gst_query_unref() * @param type the query type * @param structure a structure for the query * @return a new {@link Query} * @deprecated See {@link #custom} */ @Deprecated public static Query newCustom(org.freedesktop.gstreamer.gst.QueryType type, @Nullable org.freedesktop.gstreamer.gst.Structure structure) { var _result = constructCustom(type, structure); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_custom} constructor */ private static MemorySegment constructCustom(org.freedesktop.gstreamer.gst.QueryType type, @Nullable org.freedesktop.gstreamer.gst.Structure structure) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_custom", _fdesc, false).invokeExact(type.getValue(), (MemorySegment) (structure == null ? MemorySegment.NULL : structure.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (structure != null) MemoryCleaner.yieldOwnership(structure.handle()); return _result; } /** * Constructs a new query object for querying the drain state. *

* Free-function: gst_query_unref() * @return a new {@link Query} */ public static Query drain() { var _result = constructDrain(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the drain state. *

* Free-function: gst_query_unref() * @return a new {@link Query} * @deprecated See {@link #drain} */ @Deprecated public static Query newDrain() { var _result = constructDrain(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_drain} constructor */ private static MemorySegment constructDrain() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_drain", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new stream duration query object to query in the given format. * Use gst_query_unref() when done with it. A duration query will give the * total length of the stream. *

* Free-function: gst_query_unref() * @param format the {@link Format} for this duration query * @return a new {@link Query} */ public static Query duration(org.freedesktop.gstreamer.gst.Format format) { var _result = constructDuration(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new stream duration query object to query in the given format. * Use gst_query_unref() when done with it. A duration query will give the * total length of the stream. *

* Free-function: gst_query_unref() * @param format the {@link Format} for this duration query * @return a new {@link Query} * @deprecated See {@link #duration} */ @Deprecated public static Query newDuration(org.freedesktop.gstreamer.gst.Format format) { var _result = constructDuration(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_duration} constructor */ private static MemorySegment constructDuration(org.freedesktop.gstreamer.gst.Format format) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_duration", _fdesc, false).invokeExact(format.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying formats of * the stream. *

* Free-function: gst_query_unref() * @return a new {@link Query} */ public static Query formats() { var _result = constructFormats(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying formats of * the stream. *

* Free-function: gst_query_unref() * @return a new {@link Query} * @deprecated See {@link #formats} */ @Deprecated public static Query newFormats() { var _result = constructFormats(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_formats} constructor */ private static MemorySegment constructFormats() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_formats", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new latency query object. * Use gst_query_unref() when done with it. A latency query is usually performed * by sinks to compensate for additional latency introduced by elements in the * pipeline. *

* Free-function: gst_query_unref() * @return a {@link Query} */ public static Query latency() { var _result = constructLatency(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new latency query object. * Use gst_query_unref() when done with it. A latency query is usually performed * by sinks to compensate for additional latency introduced by elements in the * pipeline. *

* Free-function: gst_query_unref() * @return a {@link Query} * @deprecated See {@link #latency} */ @Deprecated public static Query newLatency() { var _result = constructLatency(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_latency} constructor */ private static MemorySegment constructLatency() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_latency", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query stream position query object. Use gst_query_unref() * when done with it. A position query is used to query the current position * of playback in the streams, in some format. *

* Free-function: gst_query_unref() * @param format the default {@link Format} for the new query * @return a new {@link Query} */ public static Query position(org.freedesktop.gstreamer.gst.Format format) { var _result = constructPosition(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query stream position query object. Use gst_query_unref() * when done with it. A position query is used to query the current position * of playback in the streams, in some format. *

* Free-function: gst_query_unref() * @param format the default {@link Format} for the new query * @return a new {@link Query} * @deprecated See {@link #position} */ @Deprecated public static Query newPosition(org.freedesktop.gstreamer.gst.Format format) { var _result = constructPosition(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_position} constructor */ private static MemorySegment constructPosition(org.freedesktop.gstreamer.gst.Format format) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_position", _fdesc, false).invokeExact(format.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the scheduling properties. *

* Free-function: gst_query_unref() * @return a new {@link Query} */ public static Query scheduling() { var _result = constructScheduling(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the scheduling properties. *

* Free-function: gst_query_unref() * @return a new {@link Query} * @deprecated See {@link #scheduling} */ @Deprecated public static Query newScheduling() { var _result = constructScheduling(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_scheduling} constructor */ private static MemorySegment constructScheduling() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_scheduling", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying seeking properties of * the stream. *

* Free-function: gst_query_unref() * @param format the default {@link Format} for the new query * @return a new {@link Query} */ public static Query seeking(org.freedesktop.gstreamer.gst.Format format) { var _result = constructSeeking(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying seeking properties of * the stream. *

* Free-function: gst_query_unref() * @param format the default {@link Format} for the new query * @return a new {@link Query} * @deprecated See {@link #seeking} */ @Deprecated public static Query newSeeking(org.freedesktop.gstreamer.gst.Format format) { var _result = constructSeeking(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_seeking} constructor */ private static MemorySegment constructSeeking(org.freedesktop.gstreamer.gst.Format format) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_seeking", _fdesc, false).invokeExact(format.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new segment query object. Use gst_query_unref() * when done with it. A segment query is used to discover information about the * currently configured segment for playback. *

* Free-function: gst_query_unref() * @param format the {@link Format} for the new query * @return a new {@link Query} */ public static Query segment(org.freedesktop.gstreamer.gst.Format format) { var _result = constructSegment(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new segment query object. Use gst_query_unref() * when done with it. A segment query is used to discover information about the * currently configured segment for playback. *

* Free-function: gst_query_unref() * @param format the {@link Format} for the new query * @return a new {@link Query} * @deprecated See {@link #segment} */ @Deprecated public static Query newSegment(org.freedesktop.gstreamer.gst.Format format) { var _result = constructSegment(format); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_segment} constructor */ private static MemorySegment constructSegment(org.freedesktop.gstreamer.gst.Format format) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_segment", _fdesc, false).invokeExact(format.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query object for querying the stream selection capability. *

* Free-function: gst_query_unref() * @return a new {@link Query} */ public static Query selectable() { var _result = constructSelectable(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query object for querying the stream selection capability. *

* Free-function: gst_query_unref() * @return a new {@link Query} * @deprecated See {@link #selectable} */ @Deprecated public static Query newSelectable() { var _result = constructSelectable(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_selectable} constructor */ private static MemorySegment constructSelectable() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_selectable", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Constructs a new query URI query object. Use gst_query_unref() * when done with it. An URI query is used to query the current URI * that is used by the source or sink. *

* Free-function: gst_query_unref() * @return a new {@link Query} */ public static Query uri() { var _result = constructUri(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Constructs a new query URI query object. Use gst_query_unref() * when done with it. An URI query is used to query the current URI * that is used by the source or sink. *

* Free-function: gst_query_unref() * @return a new {@link Query} * @deprecated See {@link #uri} */ @Deprecated public static Query newUri() { var _result = constructUri(); var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Helper function for the {@code gst_query_new_uri} constructor */ private static MemorySegment constructUri() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_new_uri", _fdesc, false).invokeExact(); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Add {@code api} with {@code params} as one of the supported metadata API to {@code query}. * @param api the metadata API * @param params API specific parameters */ public void addAllocationMeta(org.gnome.glib.Type api, @Nullable org.freedesktop.gstreamer.gst.Structure params) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_LONG, ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_add_allocation_meta", _fdesc, false).invokeExact(handle(), api.getValue().longValue(), (MemorySegment) (params == null ? MemorySegment.NULL : params.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Add {@code allocator} and its {@code params} as a supported memory allocator. * @param allocator the memory allocator * @param params a {@link AllocationParams} */ public void addAllocationParam(@Nullable org.freedesktop.gstreamer.gst.Allocator allocator, @Nullable org.freedesktop.gstreamer.gst.AllocationParams params) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_add_allocation_param", _fdesc, false).invokeExact(handle(), (MemorySegment) (allocator == null ? MemorySegment.NULL : allocator.handle()), (MemorySegment) (params == null ? MemorySegment.NULL : params.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the pool parameters in {@code query}. * @param pool the {@link BufferPool} * @param size the buffer size * @param minBuffers the min buffers * @param maxBuffers the max buffers */ public void addAllocationPool(@Nullable org.freedesktop.gstreamer.gst.BufferPool pool, int size, int minBuffers, int maxBuffers) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_add_allocation_pool", _fdesc, false).invokeExact(handle(), (MemorySegment) (pool == null ? MemorySegment.NULL : pool.handle()), size, minBuffers, maxBuffers); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the buffering-ranges array field in {@code query}. The current last * start position of the array should be inferior to {@code start}. * @param start start position of the range * @param stop stop position of the range * @return a {@code gboolean} indicating if the range was added or not. */ public boolean addBufferingRange(long start, long stop) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_LONG, ValueLayout.JAVA_LONG); int _result; try { _result = (int) Interop.downcallHandle("gst_query_add_buffering_range", _fdesc, false).invokeExact(handle(), start, stop); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result != 0; } /** * Add {@code mode} as one of the supported scheduling modes to {@code query}. * @param mode a {@link PadMode} */ public void addSchedulingMode(org.freedesktop.gstreamer.gst.PadMode mode) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_add_scheduling_mode", _fdesc, false).invokeExact(handle(), mode.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Copies the given query using the copy function of the parent {@link Structure}. *

* Free-function: gst_query_unref * @return a new copy of {@code q}. * @throws UnsupportedPlatformException when run on a platform other than Macos */ public org.freedesktop.gstreamer.gst.Query copy() { Platform.checkSupportedPlatform("macos"); FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_copy", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Check if {@code query} has metadata {@code api} set. When this function returns {@code true}, * {@code index} will contain the index where the requested API and the parameters * can be found. * @param api the metadata API * @param index the index * @return {@code true} when {@code api} is in the list of metadata. */ public boolean findAllocationMeta(org.gnome.glib.Type api, Out index) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_LONG, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _indexPointer = _arena.allocate(ValueLayout.JAVA_INT); int _result; try { _result = (int) Interop.downcallHandle("gst_query_find_allocation_meta", _fdesc, false).invokeExact(handle(), api.getValue().longValue(), (MemorySegment) (index == null ? MemorySegment.NULL : _indexPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (index != null) index.set(_indexPointer.get(ValueLayout.JAVA_INT, 0)); return _result != 0; } } /** * Retrieve the number of values currently stored in the * meta API array of the query's structure. * @return the metadata API array size as a {@code guint}. */ public int getNAllocationMetas() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_get_n_allocation_metas", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Retrieve the number of values currently stored in the * allocator params array of the query's structure. *

* If no memory allocator is specified, the downstream element can handle * the default memory allocator. The first memory allocator in the query * should be generic and allow mapping to system memory, all following * allocators should be ordered by preference with the preferred one first. * @return the allocator array size as a {@code guint}. */ public int getNAllocationParams() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_get_n_allocation_params", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Retrieve the number of values currently stored in the * pool array of the query's structure. * @return the pool array size as a {@code guint}. */ public int getNAllocationPools() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_get_n_allocation_pools", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Retrieve the number of values currently stored in the * buffered-ranges array of the query's structure. * @return the range array size as a {@code guint}. */ public int getNBufferingRanges() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_get_n_buffering_ranges", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Retrieve the number of values currently stored in the * scheduling mode array of the query's structure. * @return the scheduling mode array size as a {@code guint}. */ public int getNSchedulingModes() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_get_n_scheduling_modes", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result; } /** * Get the structure of a query. * @return the {@link Structure} of the query. The * structure is still owned by the query and will therefore be freed when the * query is unreffed. */ public @Nullable org.freedesktop.gstreamer.gst.Structure getStructure() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_get_structure", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Structure(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_structure_free"); } return _instance; } /** * Check if {@code query} has scheduling mode set. *

*

* When checking if upstream supports pull mode, it is usually not * enough to just check for GST_PAD_MODE_PULL with this function, you * also want to check whether the scheduling flags returned by * gst_query_parse_scheduling() have the seeking flag set (meaning * random access is supported, not only sequential pulls). *
* @param mode the scheduling mode * @return {@code true} when {@code mode} is in the list of scheduling modes. */ public boolean hasSchedulingMode(org.freedesktop.gstreamer.gst.PadMode mode) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_INT); int _result; try { _result = (int) Interop.downcallHandle("gst_query_has_scheduling_mode", _fdesc, false).invokeExact(handle(), mode.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result != 0; } /** * Check if {@code query} has scheduling mode set and {@code flags} is set in * query scheduling flags. * @param mode the scheduling mode * @param flags {@link SchedulingFlags} * @return {@code true} when {@code mode} is in the list of scheduling modes * and {@code flags} are compatible with query flags. */ public boolean hasSchedulingModeWithFlags(org.freedesktop.gstreamer.gst.PadMode mode, org.freedesktop.gstreamer.gst.SchedulingFlags flags) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT); int _result; try { _result = (int) Interop.downcallHandle("gst_query_has_scheduling_mode_with_flags", _fdesc, false).invokeExact(handle(), mode.getValue(), flags.getValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return _result != 0; } /** * Get the caps from {@code query}. The caps remains valid as long as {@code query} remains * valid. * @param caps A pointer to the caps */ public void parseAcceptCaps(Out caps) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _capsPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_accept_caps", _fdesc, false).invokeExact(handle(), (MemorySegment) (caps == null ? MemorySegment.NULL : _capsPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (caps != null) caps.set(MemorySegment.NULL.equals(_capsPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Caps(_capsPointer.get(ValueLayout.ADDRESS, 0))); } } /** * Parse the result from {@code query} and store in {@code result}. * @param result location for the result */ public void parseAcceptCapsResult(Out result) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _resultPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_accept_caps_result", _fdesc, false).invokeExact(handle(), (MemorySegment) (result == null ? MemorySegment.NULL : _resultPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (result != null) result.set(_resultPointer.get(ValueLayout.JAVA_INT, 0) != 0); } } /** * Parse an allocation query, writing the requested caps in {@code caps} and * whether a pool is needed in {@code need_pool}, if the respective parameters * are non-{@code null}. *

* Pool details can be retrieved using gst_query_get_n_allocation_pools() and * gst_query_parse_nth_allocation_pool(). * @param caps The {@link Caps} * @param needPool Whether a {@link BufferPool} is needed */ public void parseAllocation(@Nullable Out caps, Out needPool) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _capsPointer = _arena.allocate(ValueLayout.ADDRESS); MemorySegment _needPoolPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_allocation", _fdesc, false).invokeExact(handle(), (MemorySegment) (caps == null ? MemorySegment.NULL : _capsPointer), (MemorySegment) (needPool == null ? MemorySegment.NULL : _needPoolPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (caps != null) caps.set(MemorySegment.NULL.equals(_capsPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Caps(_capsPointer.get(ValueLayout.ADDRESS, 0))); if (needPool != null) needPool.set(_needPoolPointer.get(ValueLayout.JAVA_INT, 0) != 0); } } /** * Get the results of a bitrate query. See also gst_query_set_bitrate(). * @param nominalBitrate The resulting bitrate in bits per second */ public void parseBitrate(Out nominalBitrate) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _nominalBitratePointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_bitrate", _fdesc, false).invokeExact(handle(), (MemorySegment) (nominalBitrate == null ? MemorySegment.NULL : _nominalBitratePointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (nominalBitrate != null) nominalBitrate.set(_nominalBitratePointer.get(ValueLayout.JAVA_INT, 0)); } } /** * Get the percentage of buffered data. This is a value between 0 and 100. * The {@code busy} indicator is {@code true} when the buffering is in progress. * @param busy if buffering is busy, or {@code null} * @param percent a buffering percent, or {@code null} */ public void parseBufferingPercent(Out busy, Out percent) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _busyPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _percentPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_buffering_percent", _fdesc, false).invokeExact(handle(), (MemorySegment) (busy == null ? MemorySegment.NULL : _busyPointer), (MemorySegment) (percent == null ? MemorySegment.NULL : _percentPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (busy != null) busy.set(_busyPointer.get(ValueLayout.JAVA_INT, 0) != 0); if (percent != null) percent.set(_percentPointer.get(ValueLayout.JAVA_INT, 0)); } } /** * Parse an available query, writing the format into {@code format}, and * other results into the passed parameters, if the respective parameters * are non-{@code null} * @param format the format to set for the {@code segment_start} * and {@code segment_end} values, or {@code null} * @param start the start to set, or {@code null} * @param stop the stop to set, or {@code null} * @param estimatedTotal estimated total amount of download * time remaining in milliseconds, or {@code null} */ public void parseBufferingRange(@Nullable Out format, Out start, Out stop, Out estimatedTotal) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _formatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _startPointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _stopPointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _estimatedTotalPointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_buffering_range", _fdesc, false).invokeExact(handle(), (MemorySegment) (format == null ? MemorySegment.NULL : _formatPointer), (MemorySegment) (start == null ? MemorySegment.NULL : _startPointer), (MemorySegment) (stop == null ? MemorySegment.NULL : _stopPointer), (MemorySegment) (estimatedTotal == null ? MemorySegment.NULL : _estimatedTotalPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (format != null) format.set(org.freedesktop.gstreamer.gst.Format.of(_formatPointer.get(ValueLayout.JAVA_INT, 0))); if (start != null) start.set(_startPointer.get(ValueLayout.JAVA_LONG, 0)); if (stop != null) stop.set(_stopPointer.get(ValueLayout.JAVA_LONG, 0)); if (estimatedTotal != null) estimatedTotal.set(_estimatedTotalPointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Extracts the buffering stats values from {@code query}. * @param mode a buffering mode, or {@code null} * @param avgIn the average input rate, or {@code null} * @param avgOut the average output rat, or {@code null} * @param bufferingLeft amount of buffering time left in * milliseconds, or {@code null} */ public void parseBufferingStats(@Nullable Out mode, Out avgIn, Out avgOut, Out bufferingLeft) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _modePointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _avgInPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _avgOutPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _bufferingLeftPointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_buffering_stats", _fdesc, false).invokeExact(handle(), (MemorySegment) (mode == null ? MemorySegment.NULL : _modePointer), (MemorySegment) (avgIn == null ? MemorySegment.NULL : _avgInPointer), (MemorySegment) (avgOut == null ? MemorySegment.NULL : _avgOutPointer), (MemorySegment) (bufferingLeft == null ? MemorySegment.NULL : _bufferingLeftPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (mode != null) mode.set(org.freedesktop.gstreamer.gst.BufferingMode.of(_modePointer.get(ValueLayout.JAVA_INT, 0))); if (avgIn != null) avgIn.set(_avgInPointer.get(ValueLayout.JAVA_INT, 0)); if (avgOut != null) avgOut.set(_avgOutPointer.get(ValueLayout.JAVA_INT, 0)); if (bufferingLeft != null) bufferingLeft.set(_bufferingLeftPointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Get the filter from the caps {@code query}. The caps remains valid as long as * {@code query} remains valid. * @param filter A pointer to the caps filter */ public void parseCaps(Out filter) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _filterPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_caps", _fdesc, false).invokeExact(handle(), (MemorySegment) (filter == null ? MemorySegment.NULL : _filterPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (filter != null) filter.set(MemorySegment.NULL.equals(_filterPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Caps(_filterPointer.get(ValueLayout.ADDRESS, 0))); } } /** * Get the caps result from {@code query}. The caps remains valid as long as * {@code query} remains valid. * @param caps A pointer to the caps */ public void parseCapsResult(@Nullable Out caps) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _capsPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_caps_result", _fdesc, false).invokeExact(handle(), (MemorySegment) (caps == null ? MemorySegment.NULL : _capsPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (caps != null) caps.set(MemorySegment.NULL.equals(_capsPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Caps(_capsPointer.get(ValueLayout.ADDRESS, 0))); } } /** * Get the context from the context {@code query}. The context remains valid as long as * {@code query} remains valid. * @param context A pointer to store the {@link Context} */ public void parseContext(@Nullable Out context) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _contextPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_context", _fdesc, false).invokeExact(handle(), (MemorySegment) (context == null ? MemorySegment.NULL : _contextPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (context != null) context.set(MemorySegment.NULL.equals(_contextPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Context(_contextPointer.get(ValueLayout.ADDRESS, 0))); } } /** * Parse a context type from an existing GST_QUERY_CONTEXT query. * @param contextType the context type, or {@code null} * @return a {@code gboolean} indicating if the parsing succeeded. */ public boolean parseContextType(@Nullable Out contextType) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _contextTypePointer = _arena.allocate(ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_parse_context_type", _fdesc, false).invokeExact(handle(), (MemorySegment) (contextType == null ? MemorySegment.NULL : _contextTypePointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (contextType != null) contextType.set(Interop.getStringFrom(_contextTypePointer.get(ValueLayout.ADDRESS, 0), false)); return _result != 0; } } /** * Parse a convert query answer. Any of {@code src_format}, {@code src_value}, {@code dest_format}, * and {@code dest_value} may be {@code null}, in which case that value is omitted. * @param srcFormat the storage for the {@link Format} of the * source value, or {@code null} * @param srcValue the storage for the source value, or {@code null} * @param destFormat the storage for the {@link Format} of the * destination value, or {@code null} * @param destValue the storage for the destination value, * or {@code null} */ public void parseConvert(@Nullable Out srcFormat, Out srcValue, @Nullable Out destFormat, Out destValue) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _srcFormatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _srcValuePointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _destFormatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _destValuePointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_convert", _fdesc, false).invokeExact(handle(), (MemorySegment) (srcFormat == null ? MemorySegment.NULL : _srcFormatPointer), (MemorySegment) (srcValue == null ? MemorySegment.NULL : _srcValuePointer), (MemorySegment) (destFormat == null ? MemorySegment.NULL : _destFormatPointer), (MemorySegment) (destValue == null ? MemorySegment.NULL : _destValuePointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (srcFormat != null) srcFormat.set(org.freedesktop.gstreamer.gst.Format.of(_srcFormatPointer.get(ValueLayout.JAVA_INT, 0))); if (srcValue != null) srcValue.set(_srcValuePointer.get(ValueLayout.JAVA_LONG, 0)); if (destFormat != null) destFormat.set(org.freedesktop.gstreamer.gst.Format.of(_destFormatPointer.get(ValueLayout.JAVA_INT, 0))); if (destValue != null) destValue.set(_destValuePointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Parse a duration query answer. Write the format of the duration into {@code format}, * and the value into {@code duration}, if the respective variables are non-{@code null}. * @param format the storage for the {@link Format} of the duration * value, or {@code null}. * @param duration the storage for the total duration, or {@code null}. */ public void parseDuration(@Nullable Out format, Out duration) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _formatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _durationPointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_duration", _fdesc, false).invokeExact(handle(), (MemorySegment) (format == null ? MemorySegment.NULL : _formatPointer), (MemorySegment) (duration == null ? MemorySegment.NULL : _durationPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (format != null) format.set(org.freedesktop.gstreamer.gst.Format.of(_formatPointer.get(ValueLayout.JAVA_INT, 0))); if (duration != null) duration.set(_durationPointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Parse a latency query answer. * @param live storage for live or {@code null} * @param minLatency the storage for the min latency or {@code null} * @param maxLatency the storage for the max latency or {@code null} */ public void parseLatency(Out live, @Nullable org.freedesktop.gstreamer.gst.ClockTime minLatency, @Nullable org.freedesktop.gstreamer.gst.ClockTime maxLatency) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _livePointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _minLatencyPointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _maxLatencyPointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_latency", _fdesc, false).invokeExact(handle(), (MemorySegment) (live == null ? MemorySegment.NULL : _livePointer), (MemorySegment) (minLatency == null ? MemorySegment.NULL : _minLatencyPointer), (MemorySegment) (maxLatency == null ? MemorySegment.NULL : _maxLatencyPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (live != null) live.set(_livePointer.get(ValueLayout.JAVA_INT, 0) != 0); if (minLatency != null) minLatency.setValue(_minLatencyPointer.get(ValueLayout.JAVA_LONG, 0)); if (maxLatency != null) maxLatency.setValue(_maxLatencyPointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Parse the number of formats in the formats {@code query}. * @param nFormats the number of formats in this query. */ public void parseNFormats(Out nFormats) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _nFormatsPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_n_formats", _fdesc, false).invokeExact(handle(), (MemorySegment) (nFormats == null ? MemorySegment.NULL : _nFormatsPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (nFormats != null) nFormats.set(_nFormatsPointer.get(ValueLayout.JAVA_INT, 0)); } } /** * Parse an available query and get the metadata API * at {@code index} of the metadata API array. * @param index position in the metadata API array to read * @param params API specific parameters * @return a {@link org.gnome.glib.Type} of the metadata API at {@code index}. */ public org.gnome.glib.Type parseNthAllocationMeta(int index, @Nullable Out params) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_LONG, ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _paramsPointer = _arena.allocate(ValueLayout.ADDRESS); long _result; try { _result = (long) Interop.downcallHandle("gst_query_parse_nth_allocation_meta", _fdesc, false).invokeExact(handle(), index, (MemorySegment) (params == null ? MemorySegment.NULL : _paramsPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (params != null) params.set(MemorySegment.NULL.equals(_paramsPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Structure(_paramsPointer.get(ValueLayout.ADDRESS, 0))); return new org.gnome.glib.Type(_result); } } /** * Parse an available query and get the allocator and its params * at {@code index} of the allocator array. * @param index position in the allocator array to read * @param allocator variable to hold the result * @param params parameters for the allocator */ public void parseNthAllocationParam(int index, @Nullable Out allocator, @Nullable org.freedesktop.gstreamer.gst.AllocationParams params) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _allocatorPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_nth_allocation_param", _fdesc, false).invokeExact(handle(), index, (MemorySegment) (allocator == null ? MemorySegment.NULL : _allocatorPointer), (MemorySegment) (params == null ? MemorySegment.NULL : params.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (allocator != null) allocator.set((org.freedesktop.gstreamer.gst.Allocator) InstanceCache.getForType(_allocatorPointer.get(ValueLayout.ADDRESS, 0), org.freedesktop.gstreamer.gst.Allocator.AllocatorImpl::new, true)); } } /** * Get the pool parameters in {@code query}. *

* Unref {@code pool} with gst_object_unref() when it's not needed any more. * @param index index to parse * @param pool the {@link BufferPool} * @param size the buffer size * @param minBuffers the min buffers * @param maxBuffers the max buffers */ public void parseNthAllocationPool(int index, @Nullable Out pool, Out size, Out minBuffers, Out maxBuffers) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _poolPointer = _arena.allocate(ValueLayout.ADDRESS); MemorySegment _sizePointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _minBuffersPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _maxBuffersPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_nth_allocation_pool", _fdesc, false).invokeExact(handle(), index, (MemorySegment) (pool == null ? MemorySegment.NULL : _poolPointer), (MemorySegment) (size == null ? MemorySegment.NULL : _sizePointer), (MemorySegment) (minBuffers == null ? MemorySegment.NULL : _minBuffersPointer), (MemorySegment) (maxBuffers == null ? MemorySegment.NULL : _maxBuffersPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (pool != null) pool.set((org.freedesktop.gstreamer.gst.BufferPool) InstanceCache.getForType(_poolPointer.get(ValueLayout.ADDRESS, 0), org.freedesktop.gstreamer.gst.BufferPool::new, true)); if (size != null) size.set(_sizePointer.get(ValueLayout.JAVA_INT, 0)); if (minBuffers != null) minBuffers.set(_minBuffersPointer.get(ValueLayout.JAVA_INT, 0)); if (maxBuffers != null) maxBuffers.set(_maxBuffersPointer.get(ValueLayout.JAVA_INT, 0)); } } /** * Parse an available query and get the start and stop values stored * at the {@code index} of the buffered ranges array. * @param index position in the buffered-ranges array to read * @param start the start position to set, or {@code null} * @param stop the stop position to set, or {@code null} * @return a {@code gboolean} indicating if the parsing succeeded. */ public boolean parseNthBufferingRange(int index, Out start, Out stop) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _startPointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _stopPointer = _arena.allocate(ValueLayout.JAVA_LONG); int _result; try { _result = (int) Interop.downcallHandle("gst_query_parse_nth_buffering_range", _fdesc, false).invokeExact(handle(), index, (MemorySegment) (start == null ? MemorySegment.NULL : _startPointer), (MemorySegment) (stop == null ? MemorySegment.NULL : _stopPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (start != null) start.set(_startPointer.get(ValueLayout.JAVA_LONG, 0)); if (stop != null) stop.set(_stopPointer.get(ValueLayout.JAVA_LONG, 0)); return _result != 0; } } /** * Parse the format query and retrieve the {@code nth} format from it into * {@code format}. If the list contains less elements than {@code nth}, {@code format} will be * set to GST_FORMAT_UNDEFINED. * @param nth the nth format to retrieve. * @param format a pointer to store the nth format */ public void parseNthFormat(int nth, @Nullable Out format) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _formatPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_nth_format", _fdesc, false).invokeExact(handle(), nth, (MemorySegment) (format == null ? MemorySegment.NULL : _formatPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (format != null) format.set(org.freedesktop.gstreamer.gst.Format.of(_formatPointer.get(ValueLayout.JAVA_INT, 0))); } } /** * Parse an available query and get the scheduling mode * at {@code index} of the scheduling modes array. * @param index position in the scheduling modes array to read * @return a {@link PadMode} of the scheduling mode at {@code index}. */ public org.freedesktop.gstreamer.gst.PadMode parseNthSchedulingMode(int index) { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_INT); int _result; try { _result = (int) Interop.downcallHandle("gst_query_parse_nth_scheduling_mode", _fdesc, false).invokeExact(handle(), index); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } return org.freedesktop.gstreamer.gst.PadMode.of(_result); } /** * Parse a position query, writing the format into {@code format}, and the position * into {@code cur}, if the respective parameters are non-{@code null}. * @param format the storage for the {@link Format} of the * position values (may be {@code null}) * @param cur the storage for the current position (may be {@code null}) */ public void parsePosition(@Nullable Out format, Out cur) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _formatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _curPointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_position", _fdesc, false).invokeExact(handle(), (MemorySegment) (format == null ? MemorySegment.NULL : _formatPointer), (MemorySegment) (cur == null ? MemorySegment.NULL : _curPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (format != null) format.set(org.freedesktop.gstreamer.gst.Format.of(_formatPointer.get(ValueLayout.JAVA_INT, 0))); if (cur != null) cur.set(_curPointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Set the scheduling properties. * @param flags {@link SchedulingFlags} * @param minsize the suggested minimum size of pull requests * @param maxsize the suggested maximum size of pull requests: * @param align the suggested alignment of pull requests */ public void parseScheduling(@Nullable Out flags, Out minsize, Out maxsize, Out align) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _flagsPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _minsizePointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _maxsizePointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _alignPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_scheduling", _fdesc, false).invokeExact(handle(), (MemorySegment) (flags == null ? MemorySegment.NULL : _flagsPointer), (MemorySegment) (minsize == null ? MemorySegment.NULL : _minsizePointer), (MemorySegment) (maxsize == null ? MemorySegment.NULL : _maxsizePointer), (MemorySegment) (align == null ? MemorySegment.NULL : _alignPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (flags != null) flags.set(new org.freedesktop.gstreamer.gst.SchedulingFlags(_flagsPointer.get(ValueLayout.JAVA_INT, 0))); if (minsize != null) minsize.set(_minsizePointer.get(ValueLayout.JAVA_INT, 0)); if (maxsize != null) maxsize.set(_maxsizePointer.get(ValueLayout.JAVA_INT, 0)); if (align != null) align.set(_alignPointer.get(ValueLayout.JAVA_INT, 0)); } } /** * Parse a seeking query, writing the format into {@code format}, and * other results into the passed parameters, if the respective parameters * are non-{@code null} * @param format the format to set for the {@code segment_start} * and {@code segment_end} values, or {@code null} * @param seekable the seekable flag to set, or {@code null} * @param segmentStart the segment_start to set, or {@code null} * @param segmentEnd the segment_end to set, or {@code null} */ public void parseSeeking(@Nullable Out format, Out seekable, Out segmentStart, Out segmentEnd) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _formatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _seekablePointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _segmentStartPointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _segmentEndPointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_seeking", _fdesc, false).invokeExact(handle(), (MemorySegment) (format == null ? MemorySegment.NULL : _formatPointer), (MemorySegment) (seekable == null ? MemorySegment.NULL : _seekablePointer), (MemorySegment) (segmentStart == null ? MemorySegment.NULL : _segmentStartPointer), (MemorySegment) (segmentEnd == null ? MemorySegment.NULL : _segmentEndPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (format != null) format.set(org.freedesktop.gstreamer.gst.Format.of(_formatPointer.get(ValueLayout.JAVA_INT, 0))); if (seekable != null) seekable.set(_seekablePointer.get(ValueLayout.JAVA_INT, 0) != 0); if (segmentStart != null) segmentStart.set(_segmentStartPointer.get(ValueLayout.JAVA_LONG, 0)); if (segmentEnd != null) segmentEnd.set(_segmentEndPointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Parse a segment query answer. Any of {@code rate}, {@code format}, {@code start_value}, and * {@code stop_value} may be {@code null}, which will cause this value to be omitted. *

* See gst_query_set_segment() for an explanation of the function arguments. * @param rate the storage for the rate of the segment, or {@code null} * @param format the storage for the {@link Format} of the values, * or {@code null} * @param startValue the storage for the start value, or {@code null} * @param stopValue the storage for the stop value, or {@code null} */ public void parseSegment(Out rate, @Nullable Out format, Out startValue, Out stopValue) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _ratePointer = _arena.allocate(ValueLayout.JAVA_DOUBLE); MemorySegment _formatPointer = _arena.allocate(ValueLayout.JAVA_INT); MemorySegment _startValuePointer = _arena.allocate(ValueLayout.JAVA_LONG); MemorySegment _stopValuePointer = _arena.allocate(ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_parse_segment", _fdesc, false).invokeExact(handle(), (MemorySegment) (rate == null ? MemorySegment.NULL : _ratePointer), (MemorySegment) (format == null ? MemorySegment.NULL : _formatPointer), (MemorySegment) (startValue == null ? MemorySegment.NULL : _startValuePointer), (MemorySegment) (stopValue == null ? MemorySegment.NULL : _stopValuePointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (rate != null) rate.set(_ratePointer.get(ValueLayout.JAVA_DOUBLE, 0)); if (format != null) format.set(org.freedesktop.gstreamer.gst.Format.of(_formatPointer.get(ValueLayout.JAVA_INT, 0))); if (startValue != null) startValue.set(_startValuePointer.get(ValueLayout.JAVA_LONG, 0)); if (stopValue != null) stopValue.set(_stopValuePointer.get(ValueLayout.JAVA_LONG, 0)); } } /** * Get the results of a selectable query. See also gst_query_set_selectable(). * @param selectable The resulting stream selection capability */ public void parseSelectable(Out selectable) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _selectablePointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_selectable", _fdesc, false).invokeExact(handle(), (MemorySegment) (selectable == null ? MemorySegment.NULL : _selectablePointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (selectable != null) selectable.set(_selectablePointer.get(ValueLayout.JAVA_INT, 0) != 0); } } /** * Parse an URI query, writing the URI into {@code uri} as a newly * allocated string, if the respective parameters are non-{@code null}. * Free the string with g_free() after usage. * @param uri the storage for the current URI * (may be {@code null}) */ public void parseUri(@Nullable Out uri) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _uriPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_uri", _fdesc, false).invokeExact(handle(), (MemorySegment) (uri == null ? MemorySegment.NULL : _uriPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (uri != null) uri.set(Interop.getStringFrom(_uriPointer.get(ValueLayout.ADDRESS, 0), true)); } } /** * Parse an URI query, writing the URI into {@code uri} as a newly * allocated string, if the respective parameters are non-{@code null}. * Free the string with g_free() after usage. * @param uri the storage for the redirect URI * (may be {@code null}) */ public void parseUriRedirection(@Nullable Out uri) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _uriPointer = _arena.allocate(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_parse_uri_redirection", _fdesc, false).invokeExact(handle(), (MemorySegment) (uri == null ? MemorySegment.NULL : _uriPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (uri != null) uri.set(Interop.getStringFrom(_uriPointer.get(ValueLayout.ADDRESS, 0), true)); } } /** * Parse an URI query, and set {@code permanent} to {@code true} if there is a redirection * and it should be considered permanent. If a redirection is permanent, * applications should update their internal storage of the URI, otherwise * they should make all future requests to the original URI. * @param permanent if the URI redirection is permanent * (may be {@code null}) */ public void parseUriRedirectionPermanent(Out permanent) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _permanentPointer = _arena.allocate(ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_parse_uri_redirection_permanent", _fdesc, false).invokeExact(handle(), (MemorySegment) (permanent == null ? MemorySegment.NULL : _permanentPointer)); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (permanent != null) permanent.set(_permanentPointer.get(ValueLayout.JAVA_INT, 0) != 0); } } /** * Increases the refcount of the given query by one. * @return {@code q} * @throws UnsupportedPlatformException when run on a platform other than Macos */ public org.freedesktop.gstreamer.gst.Query ref() { Platform.checkSupportedPlatform("macos"); FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_ref", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Query(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_query_unref"); } return _instance; } /** * Remove the metadata API at {@code index} of the metadata API array. * @param index position in the metadata API array to remove */ public void removeNthAllocationMeta(int index) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_remove_nth_allocation_meta", _fdesc, false).invokeExact(handle(), index); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Remove the allocation param at {@code index} of the allocation param array. * @param index position in the allocation param array to remove */ public void removeNthAllocationParam(int index) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_remove_nth_allocation_param", _fdesc, false).invokeExact(handle(), index); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Remove the allocation pool at {@code index} of the allocation pool array. * @param index position in the allocation pool array to remove */ public void removeNthAllocationPool(int index) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_remove_nth_allocation_pool", _fdesc, false).invokeExact(handle(), index); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set {@code result} as the result for the {@code query}. * @param result the result to set */ public void setAcceptCapsResult(boolean result) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_accept_caps_result", _fdesc, false).invokeExact(handle(), result ? 1 : 0); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the results of a bitrate query. The nominal bitrate is the average * bitrate expected over the length of the stream as advertised in file * headers (or similar). * @param nominalBitrate the nominal bitrate in bits per second */ public void setBitrate(int nominalBitrate) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_bitrate", _fdesc, false).invokeExact(handle(), nominalBitrate); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the percentage of buffered data. This is a value between 0 and 100. * The {@code busy} indicator is {@code true} when the buffering is in progress. * @param busy if buffering is busy * @param percent a buffering percent */ public void setBufferingPercent(boolean busy, int percent) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_buffering_percent", _fdesc, false).invokeExact(handle(), busy ? 1 : 0, percent); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the available query result fields in {@code query}. * @param format the format to set for the {@code start} and {@code stop} values * @param start the start to set * @param stop the stop to set * @param estimatedTotal estimated total amount of download time remaining in * milliseconds */ public void setBufferingRange(org.freedesktop.gstreamer.gst.Format format, long start, long stop, long estimatedTotal) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG, ValueLayout.JAVA_LONG, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_buffering_range", _fdesc, false).invokeExact(handle(), format.getValue(), start, stop, estimatedTotal); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Configures the buffering stats values in {@code query}. * @param mode a buffering mode * @param avgIn the average input rate * @param avgOut the average output rate * @param bufferingLeft amount of buffering time left in milliseconds */ public void setBufferingStats(org.freedesktop.gstreamer.gst.BufferingMode mode, int avgIn, int avgOut, long bufferingLeft) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_buffering_stats", _fdesc, false).invokeExact(handle(), mode.getValue(), avgIn, avgOut, bufferingLeft); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the {@code caps} result in {@code query}. * @param caps A pointer to the caps */ public void setCapsResult(@Nullable org.freedesktop.gstreamer.gst.Caps caps) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_set_caps_result", _fdesc, false).invokeExact(handle(), (MemorySegment) (caps == null ? MemorySegment.NULL : caps.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Answer a context query by setting the requested context. * @param context the requested {@link Context} */ public void setContext(@Nullable org.freedesktop.gstreamer.gst.Context context) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_set_context", _fdesc, false).invokeExact(handle(), (MemorySegment) (context == null ? MemorySegment.NULL : context.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Answer a convert query by setting the requested values. * @param srcFormat the source {@link Format} * @param srcValue the source value * @param destFormat the destination {@link Format} * @param destValue the destination value */ public void setConvert(org.freedesktop.gstreamer.gst.Format srcFormat, long srcValue, org.freedesktop.gstreamer.gst.Format destFormat, long destValue) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_convert", _fdesc, false).invokeExact(handle(), srcFormat.getValue(), srcValue, destFormat.getValue(), destValue); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Answer a duration query by setting the requested value in the given format. * @param format the {@link Format} for the duration * @param duration the duration of the stream */ public void setDuration(org.freedesktop.gstreamer.gst.Format format, long duration) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_duration", _fdesc, false).invokeExact(handle(), format.getValue(), duration); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the formats query result fields in {@code query}. The number of formats passed * must be equal to {@code n_formats}. * @param nFormats the number of formats to set. * @param varargs A number of {@code GstFormats} equal to {@code n_formats}. */ public void setFormats(int nFormats, java.lang.Object... varargs) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_formats", _fdesc, true).invokeExact(handle(), nFormats, varargs); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the formats query result fields in {@code query}. The number of formats passed * in the {@code formats} array must be equal to {@code n_formats}. * @param formats an array containing {@code n_formats} * {@code GstFormat} values. */ public void setFormatsv(org.freedesktop.gstreamer.gst.Format[] formats) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { int nFormats = formats == null ? 0 : formats.length; try { Interop.downcallHandle("gst_query_set_formatsv", _fdesc, false).invokeExact(handle(), nFormats, (MemorySegment) (formats == null ? MemorySegment.NULL : Interop.allocateNativeArray(Enumeration.getValues(formats), false, _arena))); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } } /** * Answer a latency query by setting the requested values in the given format. * @param live if there is a live element upstream * @param minLatency the minimal latency of the upstream elements * @param maxLatency the maximal latency of the upstream elements */ public void setLatency(boolean live, org.freedesktop.gstreamer.gst.ClockTime minLatency, org.freedesktop.gstreamer.gst.ClockTime maxLatency) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_latency", _fdesc, false).invokeExact(handle(), live ? 1 : 0, minLatency.getValue().longValue(), maxLatency.getValue().longValue()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Parse an available query and get the allocator and its params * at {@code index} of the allocator array. * @param index position in the allocator array to set * @param allocator new allocator to set * @param params parameters for the allocator */ public void setNthAllocationParam(int index, @Nullable org.freedesktop.gstreamer.gst.Allocator allocator, @Nullable org.freedesktop.gstreamer.gst.AllocationParams params) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_set_nth_allocation_param", _fdesc, false).invokeExact(handle(), index, (MemorySegment) (allocator == null ? MemorySegment.NULL : allocator.handle()), (MemorySegment) (params == null ? MemorySegment.NULL : params.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the pool parameters in {@code query}. * @param index index to modify * @param pool the {@link BufferPool} * @param size the buffer size * @param minBuffers the min buffers * @param maxBuffers the max buffers */ public void setNthAllocationPool(int index, @Nullable org.freedesktop.gstreamer.gst.BufferPool pool, int size, int minBuffers, int maxBuffers) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_nth_allocation_pool", _fdesc, false).invokeExact(handle(), index, (MemorySegment) (pool == null ? MemorySegment.NULL : pool.handle()), size, minBuffers, maxBuffers); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Answer a position query by setting the requested value in the given format. * @param format the requested {@link Format} * @param cur the position to set */ public void setPosition(org.freedesktop.gstreamer.gst.Format format, long cur) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_position", _fdesc, false).invokeExact(handle(), format.getValue(), cur); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the scheduling properties. * @param flags {@link SchedulingFlags} * @param minsize the suggested minimum size of pull requests * @param maxsize the suggested maximum size of pull requests * @param align the suggested alignment of pull requests */ public void setScheduling(org.freedesktop.gstreamer.gst.SchedulingFlags flags, int minsize, int maxsize, int align) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_scheduling", _fdesc, false).invokeExact(handle(), flags.getValue(), minsize, maxsize, align); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the seeking query result fields in {@code query}. * @param format the format to set for the {@code segment_start} and {@code segment_end} values * @param seekable the seekable flag to set * @param segmentStart the segment_start to set * @param segmentEnd the segment_end to set */ public void setSeeking(org.freedesktop.gstreamer.gst.Format format, boolean seekable, long segmentStart, long segmentEnd) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_seeking", _fdesc, false).invokeExact(handle(), format.getValue(), seekable ? 1 : 0, segmentStart, segmentEnd); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Answer a segment query by setting the requested values. The normal * playback segment of a pipeline is 0 to duration at the default rate of * 1.0. If a seek was performed on the pipeline to play a different * segment, this query will return the range specified in the last seek. *

* {@code start_value} and {@code stop_value} will respectively contain the configured * playback range start and stop values expressed in {@code format}. * The values are always between 0 and the duration of the media and * {@code start_value} <= {@code stop_value}. {@code rate} will contain the playback rate. For * negative rates, playback will actually happen from {@code stop_value} to * {@code start_value}. * @param rate the rate of the segment * @param format the {@link Format} of the segment values ({@code start_value} and {@code stop_value}) * @param startValue the start value * @param stopValue the stop value */ public void setSegment(double rate, org.freedesktop.gstreamer.gst.Format format, long startValue, long stopValue) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_DOUBLE, ValueLayout.JAVA_INT, ValueLayout.JAVA_LONG, ValueLayout.JAVA_LONG); try { Interop.downcallHandle("gst_query_set_segment", _fdesc, false).invokeExact(handle(), rate, format.getValue(), startValue, stopValue); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Set the results of a selectable query. If the element answering the query can * handle stream selection, {@code selectable} should be set to {@code true}. * @param selectable Whether the element can handle stream selection. */ public void setSelectable(boolean selectable) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_selectable", _fdesc, false).invokeExact(handle(), selectable ? 1 : 0); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Answer a URI query by setting the requested URI. * @param uri the URI to set */ public void setUri(@Nullable java.lang.String uri) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { try { Interop.downcallHandle("gst_query_set_uri", _fdesc, false).invokeExact(handle(), (MemorySegment) (uri == null ? MemorySegment.NULL : Interop.allocateNativeString(uri, _arena))); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } } /** * Answer a URI query by setting the requested URI redirection. * @param uri the URI to set */ public void setUriRedirection(@Nullable java.lang.String uri) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { try { Interop.downcallHandle("gst_query_set_uri_redirection", _fdesc, false).invokeExact(handle(), (MemorySegment) (uri == null ? MemorySegment.NULL : Interop.allocateNativeString(uri, _arena))); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } } /** * Answer a URI query by setting the requested URI redirection * to permanent or not. * @param permanent whether the redirect is permanent or not */ public void setUriRedirectionPermanent(boolean permanent) { FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT); try { Interop.downcallHandle("gst_query_set_uri_redirection_permanent", _fdesc, false).invokeExact(handle(), permanent ? 1 : 0); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Decreases the refcount of the query. If the refcount reaches 0, the query * will be freed. * @throws UnsupportedPlatformException when run on a platform other than Macos */ public void unref() { Platform.checkSupportedPlatform("macos"); FunctionDescriptor _fdesc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS); try { Interop.downcallHandle("gst_query_unref", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } } /** * Get the structure of a query. This method should be called with a writable * {@code query} so that the returned structure is guaranteed to be writable. * @return the {@link Structure} of the query. The structure is * still owned by the query and will therefore be freed when the query * is unreffed. */ public org.freedesktop.gstreamer.gst.Structure writableStructure() { FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS); MemorySegment _result; try { _result = (MemorySegment) Interop.downcallHandle("gst_query_writable_structure", _fdesc, false).invokeExact(handle()); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } var _instance = MemorySegment.NULL.equals(_result) ? null : new org.freedesktop.gstreamer.gst.Structure(_result); if (_instance != null) { MemoryCleaner.takeOwnership(_instance.handle()); MemoryCleaner.setFreeFunc(_instance.handle(), "gst_structure_free"); } return _instance; } /** * Modifies a pointer to a {@link Query} to point to a different {@link Query}. The * modification is done atomically (so this is useful for ensuring thread safety * in some cases), and the reference counts are updated appropriately (the old * query is unreffed, the new one is reffed). *

* Either {@code new_query} or the {@link Query} pointed to by {@code old_query} may be {@code null}. * @param oldQuery pointer to a pointer to a * {@link Query} to be replaced. * @param newQuery pointer to a {@link Query} that will * replace the query pointed to by {@code old_query}. * @return {@code true} if {@code new_query} was different from {@code old_query} * @throws UnsupportedPlatformException when run on a platform other than Macos */ public static boolean replace(@Nullable Out oldQuery, @Nullable org.freedesktop.gstreamer.gst.Query newQuery) { Platform.checkSupportedPlatform("macos"); FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _oldQueryPointer = _arena.allocate(ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_replace", _fdesc, false).invokeExact((MemorySegment) (oldQuery == null ? MemorySegment.NULL : _oldQueryPointer), (MemorySegment) (newQuery == null ? MemorySegment.NULL : newQuery.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (oldQuery != null) oldQuery.set(MemorySegment.NULL.equals(_oldQueryPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Query(_oldQueryPointer.get(ValueLayout.ADDRESS, 0))); return _result != 0; } } /** * Modifies a pointer to a {@link Query} to point to a different {@link Query}. This * function is similar to gst_query_replace() except that it takes ownership of * {@code new_query}. *

* Either {@code new_query} or the {@link Query} pointed to by {@code old_query} may be {@code null}. * @param oldQuery pointer to a * pointer to a {@link Query} to be stolen. * @param newQuery pointer to a {@link Query} that will * replace the query pointed to by {@code old_query}. * @return {@code true} if {@code new_query} was different from {@code old_query} * @throws UnsupportedPlatformException when run on a platform other than Macos */ public static boolean take(@Nullable Out oldQuery, @Nullable org.freedesktop.gstreamer.gst.Query newQuery) { Platform.checkSupportedPlatform("macos"); FunctionDescriptor _fdesc = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS); try (Arena _arena = Arena.ofConfined()) { MemorySegment _oldQueryPointer = _arena.allocate(ValueLayout.ADDRESS); int _result; try { _result = (int) Interop.downcallHandle("gst_query_take", _fdesc, false).invokeExact((MemorySegment) (oldQuery == null ? MemorySegment.NULL : _oldQueryPointer), (MemorySegment) (newQuery == null ? MemorySegment.NULL : newQuery.handle())); } catch (Throwable _err) { throw new AssertionError("Unexpected exception occurred: ", _err); } if (oldQuery != null) oldQuery.set(MemorySegment.NULL.equals(_oldQueryPointer.get(ValueLayout.ADDRESS, 0)) ? null : new org.freedesktop.gstreamer.gst.Query(_oldQueryPointer.get(ValueLayout.ADDRESS, 0))); if (newQuery != null) MemoryCleaner.yieldOwnership(newQuery.handle()); return _result != 0; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy