org.gstreamer.event.LatencyEvent Maven / Gradle / Ivy
Show all versions of gstreamer-java Show documentation
/*
* Copyright (c) 2008 Wayne Meissner
* Copyright (C) 1999,2000 Erik Walthinsen
* 2000 Wim Taymans
* 2005 Wim Taymans
*
* This file is part of gstreamer-java.
*
* This code is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 3 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with this work. If not, see .
*/
package org.gstreamer.event;
import org.gstreamer.ClockTime;
import org.gstreamer.Event;
import org.gstreamer.lowlevel.GstNative;
import com.sun.jna.Pointer;
/**
* Notification of new latency adjustment.
*
* The event is sent upstream from the sinks and
* notifies elements that they should add an additional latency to the
* timestamps before synchronising against the clock.
*
* The latency is mostly used in live sinks and is always expressed in
* the time format.
*/
public class LatencyEvent extends Event {
private static interface API extends com.sun.jna.Library {
Pointer ptr_gst_event_new_latency(ClockTime latency);
void gst_event_parse_latency(Event event, ClockTime[] latency);
}
private static final API gst = GstNative.load(API.class);
/**
* This constructor is for internal use only.
* @param init initialization data.
*/
public LatencyEvent(Initializer init) {
super(init);
}
/**
* Create a new latency event.
*
* @param latency the new latency value to add to timestamps.
*/
public LatencyEvent(ClockTime latency) {
super(initializer(gst.ptr_gst_event_new_latency(latency)));
}
/**
* Gets the latency in the latency event.
*
* @return the latency.
*/
public ClockTime getLatency() {
ClockTime[] latency = new ClockTime[1];
gst.gst_event_parse_latency(this, latency);
return latency[0];
}
}