/** * Get a {@link Structure} contained in this caps. * * <p>Finds the structure in @caps that has the index @index, and returns it. * * @param index The index of the structure to get. * @return The Structure corresponding to index. */ public Structure getStructure(int index) { /* * WARNING: This function takes a const GstCaps *, but returns a * non-const GstStructure *. This is for programming convenience -- * the caller should be aware that structures inside a constant * #GstCaps should not be modified. */ // The above means we return a Structure proxy which does not own the pointer. // gst_caps_get_structure is not marked as CallerOwnsReturn, so it should work return GSTCAPS_API.gst_caps_get_structure(this, index); }
/** * Destructively discard all but the first structure from this caps. * * <p>Useful when fixating. This caps must be writable. * * @return truncated copy of the Caps */ public Caps truncate() { this.ref(); return GSTCAPS_API.gst_caps_truncate(this); }
/** * Create a caps that is a copy of another caps. * * @param caps The caps to copy. * @see #copy */ public Caps(Caps caps) { this(initializer(GSTCAPS_API.ptr_gst_caps_copy(caps))); }
/** * Check if this caps is always compatible with another caps. * * <p>A given Caps structure is always compatible with another if every media format that is in * the first is also contained in the second. That is, this caps1 is a subset of other. * * @param other The caps to test against. * @return true if other is always compatible with this caps. */ public boolean isAlwaysCompatible(Caps other) { return GSTCAPS_API.gst_caps_is_always_compatible(this, other); }
/** * Construct a new Caps from a string representation. Example: * * <p><code> * Caps caps = Caps.fromString("video/x-raw, format=RGB, bpp=32, depth=24, width=640, height=480"); * </code> * * @param caps The string representation of the caps. * @return The new Caps. */ public static Caps fromString(String caps) { return new Caps(initializer(GSTCAPS_API.ptr_gst_caps_from_string(caps))); }
/** * Determine if this caps represents no media formats. * * @return true if this caps represents no formats. */ public boolean isEmpty() { return GSTCAPS_API.gst_caps_is_empty(this); }
/** * Tests if two Caps are equal. This function only works on fixed Caps. * * @param other The other caps to test against. * @return true if the other caps is equal to this one. */ public boolean isEqualFixed(Caps other) { return GSTCAPS_API.gst_caps_is_equal_fixed(this, other); }
/** * Modifies this caps inplace into a representation that represents the same set of formats, but * in a simpler form. Component structures that are identical are merged. Component structures * that have values that can be merged are also merged. * * @return The new {@link Caps} */ public Caps simplify() { this.ref(); // gst_caps_simplify copies "this" and drops one reference return GSTCAPS_API.gst_caps_simplify(this); }
/** * Append the structures contained in caps to this caps object. The structures in caps are not * copied -- they are transferred to this caps. * * <p>If either caps is ANY, the resulting caps will be ANY. * * @param caps The Caps to append */ public void append(Caps caps) { GSTCAPS_API.gst_caps_append(this, caps); }
/** * Subtracts the subtrahend Caps from this Caps. * * <p><note>This function does not work reliably if optional properties for caps are included on * one caps and omitted on the other.</note> * * @param subtrahend The {@link Caps} to subtract. * @return The resulting caps. */ public Caps subtract(Caps subtrahend) { return GSTCAPS_API.gst_caps_subtract(this, subtrahend); }
/** * Normalize the Caps. * * <p>Creates a new {@link Caps} that represents the same set of formats as this Caps, but * contains no lists. Each list is expanded into separate {@link Structure}s * * @return The new {@link Caps} * @see Structure */ public Caps normalize() { this.ref(); // gst_caps_normalize copies "this" and drops one reference return GSTCAPS_API.gst_caps_normalize(this); }
/** * Creates a new {@link Caps} that contains all the formats that are common to both this Caps and * the other Caps. * * @param other The {@link Caps} to intersect with this one. * @return The new {@link Caps} */ public Caps intersect(Caps other) { return GSTCAPS_API.gst_caps_intersect(this, other); }
/** * Create a new Caps as a copy of the this caps. * * <p>The new Caps will be a copy of this caps, with all the internal structures copied as well. * * @return The new Caps. */ public Caps copy() { return GSTCAPS_API.gst_caps_copy(this); }
/** * Get the number of structures contained in this caps. * * @return the number of structures that this caps contains */ public int size() { return GSTCAPS_API.gst_caps_get_size(this); }
@Override public String toString() { return GSTCAPS_API.gst_caps_to_string(this); }
/** * Append structure to this caps. The structure is not copied; this caps takes ownership, so do * not use struct after calling this method. * * @param struct The structure to append. */ public void append(Structure struct) { GSTCAPS_API.gst_caps_append_structure(this, struct); }
/** * Determine if this caps represents any media format. * * @return true if this caps represents any format. */ public boolean isAny() { return GSTCAPS_API.gst_caps_is_any(this); }
/** * Remove a struture from the caps. Removes the stucture with the given index from the list of * structures contained in this caps. * * @param index Index of the structure to remove. */ public void removeStructure(int index) { GSTCAPS_API.gst_caps_remove_structure(this, index); }
/** * Determine if this caps is fixed. * * <p>Fixed Caps describe exactly one format, that is, they have exactly one structure, and each * field in the structure describes a fixed type. Examples of non-fixed types are * GST_TYPE_INT_RANGE and GST_TYPE_LIST. * * @return true if this caps is fixed */ public boolean isFixed() { return GSTCAPS_API.gst_caps_is_fixed(this); }
/** * Merge two {@link Caps} together. * * <p>Appends the structures contained in caps2 to caps1 if they are not yet expressed by caps1 . * The structures in caps2 are not copied -- they are transferred to a writable copy of caps1 , * and then caps2 is freed. If either caps is ANY, the resulting caps will be ANY. * * @param caps1 the {@link Caps} that will take the new entries. * @param caps2 the {@link Caps} to merge in * @return merged Caps */ public static Caps merge(Caps caps1, Caps caps2) { return GSTCAPS_API.gst_caps_merge(caps1, caps2); }
/** * Checks if all caps represented by this caps are also represented by superset. * * <p>This function does not work reliably if optional properties for caps are included on one * caps and omitted on the other. * * @param superset The potentially greater Caps * @return true if this caps is a subset of superset */ public boolean isSubset(Caps superset) { return GSTCAPS_API.gst_caps_is_subset(this, superset); }
/** * Returns a writable copy of this caps. * * <p>This method will invalidate the native side of this caps object, so it should not be used * after calling this method, and only the returned Caps object should be used. * * <p> * * @return A writable version of this caps object. */ public Caps makeWritable() { return GSTCAPS_API.gst_caps_make_writable(this); }
/** * Creates a new Caps that indicates that it is compatible with any media format. * * @return The new Caps. */ public static Caps anyCaps() { return new Caps(initializer(GSTCAPS_API.ptr_gst_caps_new_any())); }
public void setInteger(String field, Integer value) { GSTCAPS_API.gst_caps_set_simple(this, field, value, null); }
/** * Creates a new Caps that is empty. That is, the returned Caps contains no media formats. * * @see #emptyCaps */ public Caps() { this(initializer(GSTCAPS_API.ptr_gst_caps_new_empty())); }
/** * Construct a new Caps from a string representation. * * @param caps The string representation of the caps. * @see #fromString */ public Caps(String caps) { this(initializer(GSTCAPS_API.ptr_gst_caps_from_string(caps))); }