Package org.gstreamer.lowlevel.GValueAPI

Examples of org.gstreamer.lowlevel.GValueAPI.GValue


     *
     * @param pad
     * @return video framerate, otherwise null if the pad has no configured caps or the configured caps do not contain a framerate.
     */
    public static Fraction getVideoFrameRate(Pad pad) {
      final GValue gvalue = GSTVIDEO_API.gst_video_frame_rate(pad);
      return gvalue != null ? Fraction.objectFor(gvalue) : null;
    }
View Full Code Here


     * Gets ValueList field representation
     * @param fieldName The name of the field.
     * @return field as ValueList
     */
    public ValueList getValueList(String fieldName) {
      GValue val = gst.gst_structure_get_value(this, fieldName);
      if (val == null) {
        throw new InvalidFieldException("ValueList", fieldName);         
      }
      return new ValueList(val);
  }
View Full Code Here

      }
      return new ValueList(val);
  }
   
    public Object getValue(String fieldName) {
      GValue val = gst.gst_structure_get_value(this, fieldName);
     
      if (val == null) {
        throw new InvalidFieldException("Object", fieldName);         
      }

  return val.getValue();
    }
View Full Code Here

     * Gets Range field representation
     * @param fieldName The name of the field.
     * @return field as Range
     */
    public Range getRange(String fieldName) {
      GValue val = gst.gst_structure_get_value(this, fieldName);
        if (val == null) {
            throw new InvalidFieldException("Range", fieldName);         
        }
        return new Range(val);
    }
View Full Code Here

        if (propertySpec == null) {
            throw new IllegalArgumentException("Unknown property: " + property);
        }
        final GType propType = propertySpec.value_type;
       
        GValue propValue = new GValue();
        GVALUE_API.g_value_init(propValue, propType);
        if (propType.equals(GType.INT)) {
            GVALUE_API.g_value_set_int(propValue, intValue(data));
        } else if (propType.equals(GType.UINT)) {
            GVALUE_API.g_value_set_uint(propValue, intValue(data));
View Full Code Here

        GObjectAPI.GParamSpec propertySpec = findProperty(property);
        if (propertySpec == null) {
            throw new IllegalArgumentException("Unknown property: " + property);
        }
        final GType propType = propertySpec.value_type;
        GValue propValue = new GValue();
        GVALUE_API.g_value_init(propValue, propType);
        GOBJECT_API.g_object_get_property(this, property, propValue);
        if (propType.equals(GType.INT)) {
            return GVALUE_API.g_value_get_int(propValue);
        } else if (propType.equals(GType.UINT)) {
            return GVALUE_API.g_value_get_uint(propValue);
        } else if (propType.equals(GType.CHAR)) {
            return Integer.valueOf(GVALUE_API.g_value_get_char(propValue));
        } else if (propType.equals(GType.UCHAR)) {
            return Integer.valueOf(GVALUE_API.g_value_get_uchar(propValue));
        } else if (propType.equals(GType.LONG)) {
            return GVALUE_API.g_value_get_long(propValue).longValue();
        } else if (propType.equals(GType.ULONG)) {
            return GVALUE_API.g_value_get_ulong(propValue).longValue();
        } else if (propType.equals(GType.INT64)) {
            return GVALUE_API.g_value_get_int64(propValue);
        } else if (propType.equals(GType.UINT64)) {
            return GVALUE_API.g_value_get_uint64(propValue);
        } else if (propType.equals(GType.BOOLEAN)) {
            return GVALUE_API.g_value_get_boolean(propValue);
        } else if (propType.equals(GType.FLOAT)) {
            return GVALUE_API.g_value_get_float(propValue);
        } else if (propType.equals(GType.DOUBLE)) {
            return GVALUE_API.g_value_get_double(propValue);
        } else if (propType.equals(GType.STRING)) {
            return GVALUE_API.g_value_get_string(propValue);
        } else if (propType.equals(GType.OBJECT)) {
            return GVALUE_API.g_value_dup_object(propValue);
        } else if (GVALUE_API.g_value_type_transformable(propType, GType.OBJECT)) {
            return GVALUE_API.g_value_dup_object(transform(propValue, GType.OBJECT));
        } else if (GVALUE_API.g_value_type_transformable(propType, GType.INT)) {
            return GVALUE_API.g_value_get_int(transform(propValue, GType.INT));
        } else if (GVALUE_API.g_value_type_transformable(propType, GType.INT64)) {
            return GVALUE_API.g_value_get_int64(transform(propValue, GType.INT64));
        } else if (propValue.checkHolds(GType.BOXED)) {
                Class<? extends NativeObject> cls = GstTypes.classFor(propType);

                if (cls != null) {
                    Pointer ptr = GVALUE_API.g_value_get_boxed(propValue);
                    return NativeObject.objectFor(ptr, cls, -1, true);
View Full Code Here

            throw new IllegalArgumentException("Got NULL pointer for property="+property);
        }
    }
   
    private static GValue transform(GValue src, GType dstType) {
        GValue dst = new GValue();
        GVALUE_API.g_value_init(dst, dstType);
        GVALUE_API.g_value_transform(src, dst);
        return dst;
    }
View Full Code Here

        GVALUE_API.g_value_init(dst, dstType);
        GVALUE_API.g_value_transform(src, dst);
        return dst;
    }
    private static void transform(Object data, GType type, GValue dst) {
        GValue src = new GValue();
        GVALUE_API.g_value_init(src, type);
        setGValue(src, type, data);
        GVALUE_API.g_value_transform(src, dst);
    }
View Full Code Here

    @After
    public void tearDown() {
    }

    @Test public void testInt() throws Exception {
      GValue v = new GValue();
      api.g_value_init(v, GType.INT);
      api.g_value_set_int(v, 5);
     
      assertEquals("int value mismatch", 5, v.getValue());
     
      api.g_value_set_int(v, 6);
     
      assertEquals("int value mismatch", 6, v.getValue());
     
      assertTrue("type mismatch", v.getValue() instanceof Integer);
     
     
    }
View Full Code Here

    @Test public void testObjectPtrRef() throws Exception {
  // the following probably puts 'e' into the object reference map

      Element e = ElementFactory.make("fakesink", "fakesink");
     
      GValue v = new GValue();
      api.g_value_init(v, GType.OBJECT);
      api.g_value_set_object(v, e);
     
      Object obj = v.getValue();
     
      assertTrue("type mismatch", obj instanceof Element);

      assertEquals("object mismatch", e, obj);
    }
View Full Code Here

TOP

Related Classes of org.gstreamer.lowlevel.GValueAPI.GValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.