Package org.freedesktop.gstreamer.gst
Class TypeFind
java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.TypeFind
- All Implemented Interfaces:
Proxy
The following functions allow you to detect the media type of an unknown
stream.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theGetLengthCallbackcallback.static interfaceFunctional interface declaration of thePeekCallbackcallback.static interfaceFunctional interface declaration of theSuggestCallbackcallback. -
Constructor Summary
ConstructorsConstructorDescriptionTypeFind()Allocate a new TypeFind.Allocate a new TypeFind.TypeFind(MemorySegment address) Create a TypeFind proxy instance for the provided memory address.TypeFind(TypeFind.PeekCallback peek, TypeFind.SuggestCallback suggest, MemorySegment data, TypeFind.GetLengthCallback getLength) Allocate a new TypeFind with the fields set to the provided values.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. -
Method Summary
Modifier and TypeMethodDescriptionlongGet the length of the data stream.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the TypeFind classvoidoverrideGetLength(TypeFind.GetLengthCallback getLength, Arena _arena) Write a value in the fieldget_length.voidoverridePeek(TypeFind.PeekCallback peek, Arena _arena) Write a value in the fieldpeek.voidoverrideSuggest(TypeFind.SuggestCallback suggest, Arena _arena) Write a value in the fieldsuggest.@Nullable MemorySegmentpeek(long offset, int size) Returns thesizebytes of the stream to identify beginning at offset.readData()Read the value of the fielddata.static booleanregister(@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.voidIf aGstTypeFindFunctioncalls this function it suggests the caps with the given probability.voidsuggestEmptySimple(int probability, String mediaType) If aGstTypeFindFunctioncalls this function it suggests caps of the givenmediaTypewith the givenprobability.voidsuggestSimple(int probability, String mediaType, @Nullable String fieldname, Object... varargs) If aGstTypeFindFunctioncalls this function it suggests the caps with the given probability.voidwriteData(MemorySegment data) Write a value in the fielddata.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TypeFind
Create a TypeFind proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
TypeFind
Allocate a new TypeFind.- Parameters:
arena- to control the memory allocation scope
-
TypeFind
public TypeFind()Allocate a new TypeFind. The memory is allocated withArena.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 fieldpeeksuggest- callback function for the fieldsuggestdata- value for the fielddatagetLength- callback function for the fieldgetLengtharena- 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 withArena.ofAuto().- Parameters:
peek- callback function for the fieldpeeksuggest- callback function for the fieldsuggestdata- value for the fielddatagetLength- callback function for the fieldgetLength
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
overridePeek
Write a value in the fieldpeek.- Parameters:
peek- The new value for the fieldpeek_arena- to control the memory allocation scope
-
overrideSuggest
Write a value in the fieldsuggest.- Parameters:
suggest- The new value for the fieldsuggest_arena- to control the memory allocation scope
-
readData
Read the value of the fielddata.- Returns:
- The value of the field
data
-
writeData
Write a value in the fielddata.- Parameters:
data- The new value for the fielddata
-
overrideGetLength
Write a value in the fieldget_length.- Parameters:
getLength- The new value for the fieldget_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- AGstPlugin, ornullfor a static typefind functionname- The name for registeringrank- The rank (or importance) of this typefind functionfunc- TheGstTypeFindFunctionto useextensions- Optional comma-separated list of extensions that could belong to this typepossibleCaps- Optionally the caps that could be returned when typefinding succeeds- Returns:
trueon success,falseotherwise
-
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
Returns thesizebytes 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 offsetsize- The number of bytes to return- Returns:
- the
requested data, or
nullif that data is not available.
-
suggest
If aGstTypeFindFunctioncalls this function it suggests the caps with the given probability. AGstTypeFindFunctionmay supply different suggestions in one call. It is up to the caller of theGstTypeFindFunctionto interpret these values.- Parameters:
probability- The probability in percent that the suggestion is rightcaps- The fixedGstCapsto suggest
-
suggestEmptySimple
If aGstTypeFindFunctioncalls this function it suggests caps of the givenmediaTypewith the givenprobability.This function is similar to gst_type_find_suggest_simple(), but uses a
GstCapswith no fields.- Parameters:
probability- The probability in percent that the suggestion is rightmediaType- the media type of the suggested caps- Since:
- 1.20
-
suggestSimple
public void suggestSimple(int probability, String mediaType, @Nullable String fieldname, Object... varargs) If aGstTypeFindFunctioncalls this function it suggests the caps with the given probability. AGstTypeFindFunctionmay supply different suggestions in one call. It is up to the caller of theGstTypeFindFunctionto interpret these values.This function is similar to gst_type_find_suggest(), only that instead of passing a
GstCapsargument 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
nullargument 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 rightmediaType- the media type of the suggested capsfieldname- first field of the suggested caps, ornullvarargs- 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). Iffieldnameisnull, this list must be exactly onenull.
-