org.gstreamer
Class Gst

java.lang.Object
  extended by org.gstreamer.Gst

public final class Gst
extends java.lang.Object

Media library supporting arbitrary formats and filter graphs.


Method Summary
static void addStaticShutdownTask(java.lang.Runnable task)
          Adds a task to be called when deinit() is called.
static void deinit()
          Undoes all the initialization done in init().
static java.util.concurrent.Executor getExecutor()
          Gets the common Executor used to execute background tasks.
static java.util.concurrent.ExecutorService getExecutorService()
          Gets the common ExecutorService used to execute background tasks.
static GMainContext getMainContext()
          Gets the current main context used (if any).
static java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
          Gets the common ScheduledExecutorService used to execute background tasks and schedule timeouts.
static Version getVersion()
          Gets the version of gstreamer currently in use.
static java.lang.String getVersionString()
          Gets the the version of gstreamer currently in use, as a String.
static void init()
          Initializes the GStreamer library.
static java.lang.String[] init(java.lang.String progname, java.lang.String[] args)
          Initializes the GStreamer library.
static void invokeAndWait(java.lang.Runnable task)
          Executes a task on the gstreamer background Executor, waiting until the task completes before returning.
static void invokeLater(java.lang.Runnable task)
          Schedules a task for execution on the gstreamer background Executor.
static void main()
          Waits for the gstreamer system to shutdown via a call to quit.
static void quit()
          Signals the thread that called init() to return.
static void setUseDefaultContext(boolean useDefault)
          Instructs gstreamer-java to use the default main context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getVersion

public static Version getVersion()
Gets the version of gstreamer currently in use.

Returns:
the version of gstreamer

getVersionString

public static java.lang.String getVersionString()
Gets the the version of gstreamer currently in use, as a String.

Returns:
a string representation of the version.

getExecutor

public static java.util.concurrent.Executor getExecutor()
Gets the common Executor used to execute background tasks.

Returns:
an executor that can be used for background tasks.

getExecutorService

public static java.util.concurrent.ExecutorService getExecutorService()
Gets the common ExecutorService used to execute background tasks.

Returns:
an executor that can be used for background tasks.

getScheduledExecutorService

public static java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
Gets the common ScheduledExecutorService used to execute background tasks and schedule timeouts.

Returns:
an executor that can be used for background tasks.

quit

public static void quit()
Signals the thread that called init() to return.


main

public static void main()
Waits for the gstreamer system to shutdown via a call to quit.

For most gui programs, this is of little use. However, it can be a convenient way of keeping the main thread alive whilst gstreamer processing on other threads continues.


invokeLater

public static void invokeLater(java.lang.Runnable task)
Schedules a task for execution on the gstreamer background Executor.

Parameters:
task - the task to execute.

invokeAndWait

public static void invokeAndWait(java.lang.Runnable task)
Executes a task on the gstreamer background Executor, waiting until the task completes before returning.

Parameters:
task - the task to execute.

getMainContext

public static GMainContext getMainContext()
Gets the current main context used (if any).

Returns:
a main context.

init

public static final void init()
                       throws GstException
Initializes the GStreamer library.

This is a shortcut if no arguments are to be passed to gstreamer.

Throws:
GstException

init

public static final java.lang.String[] init(java.lang.String progname,
                                            java.lang.String[] args)
                                     throws GstException
Initializes the GStreamer library.

This sets up internal path lists, registers built-in elements, and loads standard plugins.

This method should be called before calling any other GLib functions. If this is not an option, your program must initialise the GLib thread system using g_thread_init() before any other GLib functions are called.

Note:

This method will throw a GstException if it fails.

Parameters:
progname - the java program name.
args - the java argument list.
Returns:
the list of arguments with any gstreamer specific options stripped out.
Throws:
GstException

deinit

public static final void deinit()
Undoes all the initialization done in init().

This will run any cleanup tasks, terminate any timers and other asynchronous tasks, and de-initialize the gstreamer library.


addStaticShutdownTask

public static void addStaticShutdownTask(java.lang.Runnable task)
Adds a task to be called when deinit() is called.

This is used internally, and is not recommended for other uses.

Parameters:
task - the task to execute.

setUseDefaultContext

public static void setUseDefaultContext(boolean useDefault)
Instructs gstreamer-java to use the default main context.

This may be useful if integration with the GTK main loop is desirable, as all Bus signals and timers will be executed in the context of the GTK main loop.

For the majority of programs though, it is better to wrap the individual listeners in a proxy which executes the listener in the appropriate context.

Parameters:
useDefault - if true, use the default glib main context.


Copyright © 2010. All Rights Reserved.