Package com.sun.jna

Examples of com.sun.jna.Pointer


  }
 
  private int buffer_data(FileInputStream in, ogg_sync_state oy) throws IOException
  {
    final int BUFSIZE = 4096;
    Pointer buffer = OGG.ogg_sync_buffer(oy, new NativeLong(BUFSIZE));
    byte[] buffer2 = new byte[BUFSIZE]; // TODO: this is inefficient.
    int bytes = in.read(buffer2, 0, BUFSIZE);
    if (bytes < 0)
      return bytes; // EOF
    buffer.write(0, buffer2, 0, bytes);
    OGG.ogg_sync_wrote(oy, new NativeLong(bytes));
    return (bytes);
  }
View Full Code Here


  }
 
  private int buffer_data(PullSourceStream in, ogg_sync_state oy) throws IOException
  {
    final int BUFSIZE = 4096;
    Pointer buffer = OGG.ogg_sync_buffer(oy, new NativeLong(BUFSIZE));
    byte[] buffer2 = new byte[BUFSIZE]; // TODO: this is inefficient.
    int bytes = in.read(buffer2, 0, BUFSIZE);
    if (bytes < 0)
      return bytes; // EOF
    buffer.write(0, buffer2, 0, bytes);
    OGG.ogg_sync_wrote(oy, new NativeLong(bytes));
    return (bytes);
  }
View Full Code Here

        /* if there's pending, decoded audio, grab it */
        if ((ret = VORBIS.vorbis_synthesis_pcmout(vd, pcm)) > 0)
        {

          final Pointer ppChannels = pcm.getValue();
          final Pointer[] pChannels = ppChannels.getPointerArray(0, vi.channels);

          final float[][] floatArrays = new float[pChannels.length][];
          for (int k = 0; k < pChannels.length; ++k)
          {
            floatArrays[k] = pChannels[k].getFloatArray(0, ret);
View Full Code Here

     * Retrieves the current channel from the tuner.
     *
     * @return the current channel of the tuner
     */
    public TunerChannel getChannel() {
        Pointer ptr = GSTTUNER_API.gst_tuner_get_channel(this);
        if (ptr == null) {
            return null;
        }
        return new TunerChannel(this, ptr, false, true);
    }
View Full Code Here

     * @param name the name of the channel to find
     *
     * @return the <tt>TunerChannel</tt> if found, else null
     */
    public TunerChannel getChannelByName(String name) {
        Pointer ptr = GSTTUNER_API.gst_tuner_find_channel_by_name(this, name);
        if (ptr == null) {
            return null;
        }
        return new TunerChannel(this, ptr, false, true);
    }
View Full Code Here

        String[] toStringArray() {
            //
            // Unpack the native arguments back into a String array
            //
            List<String> args = new ArrayList<String>();
            Pointer argv = argvRef.getValue();
            for (int i = 1; i < argcRef.getValue(); i++) {
                Pointer arg = argv.getPointer(i * Pointer.SIZE);
                if (arg != null) {
                    args.add(arg.getString(0, false));
                }
            }
            return args.toArray(new String[args.size()]);
        }  
View Full Code Here

    public Buffer(int size) {
        this(initializer(allocBuffer(size)));
    }
   
    private static Pointer allocBuffer(int size) {
        Pointer ptr = gst.ptr_gst_buffer_new_and_alloc(size);
        if (ptr == null) {
            throw new OutOfMemoryError("Could not allocate Buffer of size "+ size);
        }
        return ptr;
    }
View Full Code Here

     * @return A {@link java.nio.ByteBuffer} that can access this Buffer's data.
     */
    public synchronized ByteBuffer getByteBuffer() {
        if (byteBuffer == null) {
            int size = getSize();
            Pointer data = (Pointer) struct.readField("data");
            if (data != null && size > 0) {
                byteBuffer = data.getByteBuffer(0, size);
            }
        }
        return byteBuffer;
    }
View Full Code Here

      bus.connect(new Bus.MESSAGE() {
      public void busMessage(Bus bus, Message message) {
        if (message.getSource().getNativeAddress().equals(getNativeAddress())) {
          final Structure structure = message.getStructure();
          if (structure != null && "have-ns-view".equals(structure.getName())) {
            final Pointer nsview = (Pointer) structure.getValue("nsview");
            fireNewVideoComponent(nsview);
          }
        }
      }
    });
View Full Code Here

    public List<Property> getProperties() {
        return propertiesList(GSTPROPERTYPROBE_API.gst_property_probe_get_properties(this), true, true);
    }

    public Property getProperty(String name) {
        Pointer ptr = GSTPROPERTYPROBE_API.gst_property_probe_get_property(this, name);
        if (ptr == null) {
            return null;
        }
        Property p = new Property(ptr, false, false);
        return p;
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.