## GstThread

GstThread — A GstBin that executes automatically using a separate thread

## Synopsis

    #include <gst/gst.h>

                GstThread;
    extern      GPrivate *gst_thread_current;
    enum        GstThreadState;
    GstElement* gst_thread_new                  (const gchar *name);
    void        gst_thread_set_priority         (GstThread *thread,
                                                 GThreadPriority priority);
    GstThread*  gst_thread_get_current          (void);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBin
                         +----GstThread

## Implemented Interfaces

GstThread implements

## Properties

      "priority"             GstThreadPriority     : Read / Write

## Signal Prototypes

    "shutdown"  void        user_function      (GstThread *gstthread,
                                                gpointer user_data);

## Description

A bin that will become a thread if possible when the pipeline is started up. It can contain any set of GstObjects.

A Thread can act as a toplevel bin as it has its own scheduler.

## Details

### GstThread

    typedef struct _GstThread GstThread;

### gst_thread_current

    extern GPrivate *gst_thread_current;

### enum GstThreadState

    typedef enum {
      GST_THREAD_STATE_SPINNING	= GST_BIN_FLAG_LAST,
      GST_THREAD_STATE_REAPING,
      GST_THREAD_STATE_WAITING,

      /* padding */
      GST_THREAD_FLAG_LAST 		= GST_BIN_FLAG_LAST + 4
    } GstThreadState;

Flags about the current thread state

`GST_THREAD_STATE_SPINNING` | The thread is runnning
`GST_THREAD_STATE_REAPING` | The thread is ending
`GST_THREAD_STATE_WAITING` | The thread is waiting to be run again
`GST_THREAD_FLAG_LAST` | subclass use this to start their enumeration

### gst_thread_new ()

    GstElement* gst_thread_new                  (const gchar *name);

Create a new thread with the given name.

`name` : | the name of the thread
Returns : | The new thread

### gst_thread_set_priority ()

    void        gst_thread_set_priority         (GstThread *thread,
                                                 GThreadPriority priority);

change the thread's priority

`thread` : | the thread to change
`priority` : | the new priority for the thread

### gst_thread_get_current ()

    GstThread*  gst_thread_get_current          (void);

Gets the current GstThread.

Returns : | The current GstThread or NULL if you are not running inside a GstThread.

## Properties

### The "`priority`" property

      "priority"             GstThreadPriority     : Read / Write

The thread priority

Default value: NORMAL

## Signals

### The "shutdown" signal

    void        user_function                  (GstThread *gstthread,
                                                gpointer user_data);

`gstthread` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

## See Also

GstBin, GstPipeline