GstTaskPool

GstTaskPool — Pool of GStreamer streaming threads

Synopsis

#include <gst/gst.h>

struct              GstTaskPool;
struct              GstTaskPoolClass;
void                (*GstTaskPoolFunction)              (void *data);
GstTaskPool *       gst_task_pool_new                   (void);
void                gst_task_pool_prepare               (GstTaskPool *pool,
                                                         GError **error);
gpointer            gst_task_pool_push                  (GstTaskPool *pool,
                                                         GstTaskPoolFunction func,
                                                         gpointer user_data,
                                                         GError **error);
void                gst_task_pool_join                  (GstTaskPool *pool,
                                                         gpointer id);
void                gst_task_pool_cleanup               (GstTaskPool *pool);

Object Hierarchy

  GObject
   +----GstObject
         +----GstTaskPool

Description

This object provides an abstraction for creating threads. The default implementation uses a regular GThreadPool to start tasks.

Subclasses can be made to create custom threads.

Last reviewed on 2009-04-23 (0.10.24)

Details

struct GstTaskPool

struct GstTaskPool;

The GstTaskPool object.


struct GstTaskPoolClass

struct GstTaskPoolClass {
  GstObjectClass parent_class;

  void      (*prepare)  (GstTaskPool *pool, GError **error);
  void      (*cleanup)  (GstTaskPool *pool);

  gpointer  (*push)     (GstTaskPool *pool, GstTaskPoolFunction func,
                         gpointer user_data, GError **error);
  void      (*join)     (GstTaskPool *pool, gpointer id);
};

The GstTaskPoolClass object.

GstObjectClass parent_class;

the parent class structure

prepare ()

prepare the threadpool

cleanup ()

make sure all threads are stopped

push ()

start a new thread

join ()

join a thread

GstTaskPoolFunction ()

void                (*GstTaskPoolFunction)              (void *data);

Task function, see gst_task_pool_push().

data :

user data for the task function

Since 0.10.24


gst_task_pool_new ()

GstTaskPool *       gst_task_pool_new                   (void);

Create a new default task pool. The default task pool will use a regular GThreadPool for threads.

Returns :

a new GstTaskPool. gst_object_unref() after usage. [transfer full]

Since 0.10.24


gst_task_pool_prepare ()

void                gst_task_pool_prepare               (GstTaskPool *pool,
                                                         GError **error);

Prepare the taskpool for accepting gst_task_pool_push() operations.

MT safe.

pool :

a GstTaskPool

error :

an error return location

Since 0.10.24


gst_task_pool_push ()

gpointer            gst_task_pool_push                  (GstTaskPool *pool,
                                                         GstTaskPoolFunction func,
                                                         gpointer user_data,
                                                         GError **error);

Start the execution of a new thread from pool.

pool :

a GstTaskPool

func :

the function to call

user_data :

data to pass to func. [closure]

error :

return location for an error

Returns :

a pointer that should be used for the gst_task_pool_join function. This pointer can be NULL, you must check error to detect errors.

Since 0.10.24


gst_task_pool_join ()

void                gst_task_pool_join                  (GstTaskPool *pool,
                                                         gpointer id);

Join a task and/or return it to the pool. id is the id obtained from gst_task_pool_push().

pool :

a GstTaskPool

id :

the id

Since 0.10.24


gst_task_pool_cleanup ()

void                gst_task_pool_cleanup               (GstTaskPool *pool);

Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.

MT safe.

pool :

a GstTaskPool

Since 0.10.24

See Also

GstTask, GstPad