00001
00002
00003 #ifndef _GSTREAMERMM_TASK_H
00004 #define _GSTREAMERMM_TASK_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <gst/gsttask.h>
00029 #include <gstreamermm/object.h>
00030
00031
00032 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00033 typedef struct _GstTask GstTask;
00034 typedef struct _GstTaskClass GstTaskClass;
00035 #endif
00036
00037
00038 namespace Gst
00039 { class Task_Class; }
00040 namespace Gst
00041 {
00042
00048 enum TaskState
00049 {
00050 TASK_STARTED,
00051 TASK_STOPPED,
00052 TASK_PAUSED
00053 };
00054
00055 }
00056
00057
00058 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00059 namespace Glib
00060 {
00061
00062 template <>
00063 class Value<Gst::TaskState> : public Glib::Value_Enum<Gst::TaskState>
00064 {
00065 public:
00066 static GType value_type() G_GNUC_CONST;
00067 };
00068
00069 }
00070 #endif
00071
00072
00073 namespace Gst
00074 {
00075
00076
00077 class TaskPool;
00078
00110 class Task : public Object
00111 {
00112
00113 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00114
00115 public:
00116 typedef Task CppObjectType;
00117 typedef Task_Class CppClassType;
00118 typedef GstTask BaseObjectType;
00119 typedef GstTaskClass BaseClassType;
00120
00121 private: friend class Task_Class;
00122 static CppClassType task_class_;
00123
00124 private:
00125
00126 Task(const Task&);
00127 Task& operator=(const Task&);
00128
00129 protected:
00130 explicit Task(const Glib::ConstructParams& construct_params);
00131 explicit Task(GstTask* castitem);
00132
00133 #endif
00134
00135 public:
00136 virtual ~Task();
00137
00138 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00139 static GType get_type() G_GNUC_CONST;
00140
00141
00142 static GType get_base_type() G_GNUC_CONST;
00143 #endif
00144
00146 GstTask* gobj() { return reinterpret_cast<GstTask*>(gobject_); }
00147
00149 const GstTask* gobj() const { return reinterpret_cast<GstTask*>(gobject_); }
00150
00152 GstTask* gobj_copy();
00153
00154 private:
00155
00156
00157 public:
00161 typedef sigc::slot<void> SlotTask;
00162
00168 typedef sigc::slot<void, const Glib::RefPtr<Gst::Task>&, Glib::Thread*> SlotEnter;
00169
00175 typedef sigc::slot<void, const Glib::RefPtr<Gst::Task>&, Glib::Thread*> SlotLeave;
00176
00177 protected:
00178 Task(const SlotTask& task_slot);
00179
00180 public:
00191 static Glib::RefPtr<Task> create(const SlotTask& task_slot);
00192
00193
00203 void set_lock(Glib::StaticRecMutex& mutex);
00204
00214 void set_priority(Glib::ThreadPriority priority);
00215
00224 void set_pool(const Glib::RefPtr<Gst::TaskPool>& pool);
00225
00235 Glib::RefPtr<Gst::TaskPool> get_pool();
00236
00246 Glib::RefPtr<const Gst::TaskPool> get_pool() const;
00247
00265 void set_thread_slots(const SlotEnter& enter_slot, const SlotLeave& leave_slot);
00266
00267
00273 TaskState get_state() const;
00274
00287 void set_state(Gst::TaskState state);
00288
00297 bool pause();
00298
00305 bool start();
00306
00314 bool stop();
00315
00328 bool join();
00329
00335 static void cleanup_all();
00336
00337 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00338 private:
00339 SlotTask* slot;
00340 bool _slot_set;
00341 #endif
00342
00343
00344 public:
00345
00346 public:
00347
00348 #ifdef GLIBMM_VFUNCS_ENABLED
00349 #endif //GLIBMM_VFUNCS_ENABLED
00350
00351 protected:
00352
00353 #ifdef GLIBMM_VFUNCS_ENABLED
00354 #endif //GLIBMM_VFUNCS_ENABLED
00355
00356
00357 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00358 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00359
00360
00361 };
00362
00363 }
00364
00365
00366 namespace Glib
00367 {
00376 Glib::RefPtr<Gst::Task> wrap(GstTask* object, bool take_copy = false);
00377 }
00378
00379
00380 #endif
00381