Class TypeFind

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.TypeFind
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class TypeFind extends ProxyInstance
The following functions allow you to detect the media type of an unknown stream.
  • Constructor Details

    • TypeFind

      public TypeFind(MemorySegment address)
      Create a TypeFind proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • TypeFind

      public TypeFind(Arena arena)
      Allocate a new TypeFind.
      Parameters:
      arena - to control the memory allocation scope
    • TypeFind

      public TypeFind()
      Allocate a new TypeFind. The memory is allocated with Arena.ofAuto().
    • TypeFind

      public TypeFind(TypeFind.PeekCallback peek, TypeFind.SuggestCallback suggest, MemorySegment data, TypeFind.GetLengthCallback getLength, Arena arena)
      Allocate a new TypeFind with the fields set to the provided values.
      Parameters:
      peek - callback function for the field peek
      suggest - callback function for the field suggest
      data - value for the field data
      getLength - callback function for the field getLength
      arena - to control the memory allocation scope
    • TypeFind

      public TypeFind(TypeFind.PeekCallback peek, TypeFind.SuggestCallback suggest, MemorySegment data, TypeFind.GetLengthCallback getLength)
      Allocate a new TypeFind with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      peek - callback function for the field peek
      suggest - callback function for the field suggest
      data - value for the field data
      getLength - callback function for the field getLength
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the TypeFind class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • overridePeek

      public void overridePeek(TypeFind.PeekCallback peek, Arena _arena)
      Write a value in the field peek.
      Parameters:
      peek - The new value for the field peek
      _arena - to control the memory allocation scope
    • overrideSuggest

      public void overrideSuggest(TypeFind.SuggestCallback suggest, Arena _arena)
      Write a value in the field suggest.
      Parameters:
      suggest - The new value for the field suggest
      _arena - to control the memory allocation scope
    • readData

      public MemorySegment readData()
      Read the value of the field data.
      Returns:
      The value of the field data
    • writeData

      public void writeData(MemorySegment data)
      Write a value in the field data.
      Parameters:
      data - The new value for the field data
    • overrideGetLength

      public void overrideGetLength(TypeFind.GetLengthCallback getLength, Arena _arena)
      Write a value in the field get_length.
      Parameters:
      getLength - The new value for the field get_length
      _arena - to control the memory allocation scope
    • register

      public static boolean register(@Nullable Plugin plugin, String name, int rank, @Nullable TypeFindFunction func, @Nullable String extensions, @Nullable Caps possibleCaps)
      Registers a new typefind function to be used for typefinding. After registering this function will be available for typefinding. This function is typically called during an element's plugin initialization.
      Parameters:
      plugin - A GstPlugin, or null for a static typefind function
      name - The name for registering
      rank - The rank (or importance) of this typefind function
      func - The GstTypeFindFunction to use
      extensions - Optional comma-separated list of extensions that could belong to this type
      possibleCaps - Optionally the caps that could be returned when typefinding succeeds
      Returns:
      true on success, false otherwise
    • getLength

      public long getLength()
      Get the length of the data stream.
      Returns:
      The length of the data stream, or 0 if it is not available.
    • peek

      public @Nullable MemorySegment peek(long offset, int size)
      Returns the size bytes of the stream to identify beginning at offset. If offset is a positive number, the offset is relative to the beginning of the stream, if offset is a negative number the offset is relative to the end of the stream. The returned memory is valid until the typefinding function returns and must not be freed.
      Parameters:
      offset - The offset
      size - The number of bytes to return
      Returns:
      the requested data, or null if that data is not available.
    • suggest

      public void suggest(int probability, Caps caps)
      If a GstTypeFindFunction calls this function it suggests the caps with the given probability. A GstTypeFindFunction may supply different suggestions in one call. It is up to the caller of the GstTypeFindFunction to interpret these values.
      Parameters:
      probability - The probability in percent that the suggestion is right
      caps - The fixed GstCaps to suggest
    • suggestEmptySimple

      public void suggestEmptySimple(int probability, String mediaType)

      If a GstTypeFindFunction calls this function it suggests caps of the given mediaType with the given probability.

      This function is similar to gst_type_find_suggest_simple(), but uses a GstCaps with no fields.

      Parameters:
      probability - The probability in percent that the suggestion is right
      mediaType - the media type of the suggested caps
      Since:
      1.20
    • suggestSimple

      public void suggestSimple(int probability, String mediaType, @Nullable String fieldname, Object... varargs)

      If a GstTypeFindFunction calls this function it suggests the caps with the given probability. A GstTypeFindFunction may supply different suggestions in one call. It is up to the caller of the GstTypeFindFunction to interpret these values.

      This function is similar to gst_type_find_suggest(), only that instead of passing a GstCaps argument you can create the caps on the fly in the same way as you can with gst_caps_new_simple().

      Make sure you terminate the list of arguments with a null argument and that the values passed have the correct type (in terms of width in bytes when passed to the vararg function - this applies particularly to gdouble and guint64 arguments).

      Parameters:
      probability - The probability in percent that the suggestion is right
      mediaType - the media type of the suggested caps
      fieldname - first field of the suggested caps, or null
      varargs - additional arguments to the suggested caps in the same format as the arguments passed to gst_structure_new() (ie. triplets of field name, field GType and field value). If fieldname is null, this list must be exactly one null.