org.gstreamer.lowlevel
Class MainLoop

java.lang.Object
  extended by org.gstreamer.lowlevel.NativeValue
      extended by org.gstreamer.lowlevel.Handle
          extended by org.gstreamer.lowlevel.NativeObject
              extended by org.gstreamer.lowlevel.RefCountedObject
                  extended by org.gstreamer.lowlevel.MainLoop

public class MainLoop
extends RefCountedObject

The GLib main loop.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.gstreamer.lowlevel.NativeObject
NativeObject.Initializer
 
Field Summary
 
Fields inherited from class org.gstreamer.lowlevel.NativeObject
defaultInit, LIFECYCLE, ownsHandle
 
Constructor Summary
MainLoop()
          Creates a new instance of MainLoop
MainLoop(NativeObject.Initializer init)
          Creates a new instance of MainLoop
 
Method Summary
protected  void disposeNativeHandle(com.sun.jna.Pointer ptr)
          Frees the native GMainLoop
 GMainContext getMainContext()
          Gets the main context for this main loop.
 void invokeAndWait(java.lang.Runnable r)
          Invokes a task on the main loop thread.
 void invokeLater(java.lang.Runnable r)
          Invokes a task on the main loop thread.
 boolean isRunning()
          Returns whether this main loop is currently processing or not.
 void quit()
          Instructs a main loop to stop processing and return from run().
protected  void ref()
          Increases the reference count on the native GMainLoop
 void run()
          Enter a loop, processing all events.
 void startInBackground()
          Runs the main loop in a background thread.
protected  void unref()
          Decreases the reference count on the native GMainLoop
 
Methods inherited from class org.gstreamer.lowlevel.NativeObject
classFor, disown, dispose, equals, finalize, getNativeAddress, handle, hashCode, initializer, initializer, instanceFor, invalidate, isDisposed, nativeValue, objectFor, objectFor, objectFor, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MainLoop

public MainLoop()
Creates a new instance of MainLoop

This will create a new main loop on the default gstreamer main context.


MainLoop

public MainLoop(NativeObject.Initializer init)
Creates a new instance of MainLoop

This variant is used internally.

Parameters:
init - internal initialization data.
Method Detail

quit

public void quit()
Instructs a main loop to stop processing and return from run().


run

public void run()
Enter a loop, processing all events.

The loop will continue processing events until quit() is called.


isRunning

public boolean isRunning()
Returns whether this main loop is currently processing or not.

Returns:
true if the main loop is currently being run.

getMainContext

public GMainContext getMainContext()
Gets the main context for this main loop.

Returns:
a main context.

startInBackground

public void startInBackground()
Runs the main loop in a background thread.


invokeAndWait

public void invokeAndWait(java.lang.Runnable r)
Invokes a task on the main loop thread.

This method will wait until the task has completed before returning.

Parameters:
r - the task to invoke.

invokeLater

public void invokeLater(java.lang.Runnable r)
Invokes a task on the main loop thread.

This method returns immediately, without waiting for the task to complete.

Parameters:
r - the task to invoke.

ref

protected void ref()
Increases the reference count on the native GMainLoop

Specified by:
ref in class RefCountedObject

unref

protected void unref()
Decreases the reference count on the native GMainLoop

Specified by:
unref in class RefCountedObject

disposeNativeHandle

protected void disposeNativeHandle(com.sun.jna.Pointer ptr)
Frees the native GMainLoop

Specified by:
disposeNativeHandle in class NativeObject