Package com.sun.jna

Examples of com.sun.jna.Pointer


     * Saves an existing pipeline to a XML file.
     *
     * @param element the element to save
     */
    public void saveElement(Element element) {
        Pointer fp = LibC.INSTANCE.fopen(file.getAbsolutePath(), "w");
        if (fp == null) {
            throw new GstException("Could not open " + file
                    + " [errno=" + Native.getLastError() + "]");
        }
        gst.gst_xml_write_file(element, fp);
View Full Code Here


     * @param name the name to assign to the created Element
     * @return A new {@link Element}
     */
    public Element create(String name) {
        logger.entering("ElementFactory", "create", name);
        Pointer elem = gst.ptr_gst_element_factory_create(this, name);
        logger.log(DEBUG, "gst_element_factory_create returned: " + elem);
        if (elem == null) {
            throw new IllegalArgumentException("Cannot create GstElement");
        }
        return elementFor(elem, getName());
View Full Code Here

        return elementFor(makeRawElement(factoryName, name), factoryName);
    }

    static Pointer makeRawElement(String factoryName, String name) {
        logger.entering("ElementFactory", "makeRawElement", new Object[] { factoryName, name});
        Pointer elem = gst.ptr_gst_element_factory_make(factoryName, name);
        logger.log(DEBUG, "Return from gst_element_factory_make=" + elem);
        if (elem == null) {
            throw new IllegalArgumentException("No such Gstreamer factory: "
                    + factoryName);
        }
View Full Code Here

   * old_state=READY and new_state=PAUSED), since before that the list might not
   * be complete yet or not contain all available information (like
   * language-codes).
   */
  public List<StreamInfo> getStreamInfo() {
    Pointer ptr = getPointer("stream-info-value-array");
    if (ptr != null) {
      GValueArray garray = new GValueArray(ptr);
      List<StreamInfo> list = new ArrayList<StreamInfo>(garray.getNValues());

      for (GValueAPI.GValue value : garray.values) {
        StreamInfo streamInfo;
        { /*
           * this is a work-around gst_stream_info_get_type() symbols not
           * available in one of the top-level shared objects (libgstreamer or
           * libgstbase). As a result, StreamInfo.class can not be registered in
           * GstTypes even though if is an instance of GObject. value.getValue()
           * will fail to resolve to an instance of StreamInfo. Here we bypass
           * JNA type mapping that would occur had we called
           * GValueAPI.g_value_get_object()
           */
          Pointer p = GValueAPI.GVALUE_NOMAPPER_API.g_value_get_object(value);
          streamInfo = NativeObject.objectFor(p, StreamInfo.class, -1, true);
        }
        list.add(streamInfo);
      }
      return list;
View Full Code Here

            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);
                }
        }
       
        throw new IllegalArgumentException("Unknown conversion from GType=" + propType);
View Full Code Here

        PointerByReference refPtr = new PointerByReference();
        GOBJECT_API.g_object_get(this, property, refPtr, null);

        if (refPtr != null) {
            Pointer ptr = refPtr.getValue();
            return ptr;
        } else {
            throw new IllegalArgumentException("Got NULL pointer for property="+property);
        }
    }
View Full Code Here

    public static <T extends GObject> T objectFor(Pointer ptr, Class<T> defaultClass) {
        return GObject.objectFor(ptr, defaultClass, true);
    }
   
    private GObjectAPI.GParamSpec findProperty(String propertyName) {
        Pointer ptr = GOBJECT_API.g_object_class_find_property(handle().getPointer(0), propertyName);
        if (ptr == null)
            return null;
        return new GObjectAPI.GParamSpec(ptr);
    }
View Full Code Here

            return null;
        return new GObjectAPI.GParamSpec(ptr);
    }
   
    private GObjectAPI.GParamSpecTypeSpecific findProperty(String propertyName, GType type) {
      Pointer ptr = GOBJECT_API.g_object_class_find_property(handle().getPointer(0), propertyName);
      if (type.equals(GType.INT))
        return new GObjectAPI.GParamSpecInt(ptr);
      else if(type.equals(GType.UINT))
        return new GObjectAPI.GParamSpecUInt(ptr);
      else if(type.equals(GType.CHAR))
View Full Code Here

    /**
     * Test type conversion of object value trying to bypass the object reference map
     */
     @Test public void testObjectTypeMap() throws Exception {

   Pointer p;
  
   {
       /*
        * Not using ElementFactory.make() here probably prevents the element
        * from being placed in the object reference map and therefore forces
View Full Code Here

        }
        public GValueArray(Pointer pointer) {
            n_values = pointer.getInt(0);

            if (n_values > 0) {
                Pointer pointerToArray = pointer.getPointer(GType.SIZE);
                GValue val = new GValue(pointerToArray);
                values = (GValue[]) val.toArray(n_values);
            } else {
                values = new GValue[0];
            }
View Full Code Here

TOP

Related Classes of com.sun.jna.Pointer

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.