| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!cxx . . $ `<file>/gstreamer/gstreamermm/task.h`/ |
| 2 | #ifndef _GSTREAMERMM_TASK_H |
| 3 | #define _GSTREAMERMM_TASK_Hcxx . . $ `gstreamer/gstreamermm/task.h:3:9`! |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2008-2015 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <gst/gst.h> |
| 29 | #include <gstreamermm/object.h>cxx . . $ `<file>/gstreamer/gstreamermm/object.h`/ |
| 30 | #include <glibmm/threads.h> |
| 31 | #include <memory> |
| 32 | |
| 33 | |
| 34 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 35 | using GstTaskcxx . . $ GstTask# = struct _GstTaskcxx . . $ _GstTask#; |
| 36 | using GstTaskClasscxx . . $ GstTaskClass# = struct _GstTaskClasscxx . . $ _GstTaskClass#; |
| 37 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 38 | |
| 39 | |
| 40 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 41 | namespace Gstcxx . . $ Gst/ |
| 42 | { class Task_Classcxx . . $ Gst/Task_Class#; } // namespace Gst |
| 43 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 44 | |
| 45 | namespace Gstcxx . . $ Gst/ |
| 46 | { |
| 47 | |
| 48 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 49 | |
| 50 | /** |
| 51 | * @var TaskState TASK_STARTED |
| 52 | * The task is started and running. |
| 53 | * |
| 54 | * @var TaskState TASK_STOPPED |
| 55 | * The task is stopped. |
| 56 | * |
| 57 | * @var TaskState TASK_PAUSED |
| 58 | * The task is paused. |
| 59 | * |
| 60 | * @enum TaskState |
| 61 | * |
| 62 | * The different states a task can be in |
| 63 | * |
| 64 | * @ingroup gstreamermmEnums |
| 65 | */ |
| 66 | enum TaskStatecxx . . $ Gst/TaskState# |
| 67 | { |
| 68 | TASK_STARTEDcxx . . $ Gst/TASK_STARTED., |
| 69 | TASK_STOPPEDcxx . . $ Gst/TASK_STOPPED., |
| 70 | TASK_PAUSEDcxx . . $ Gst/TASK_PAUSED. |
| 71 | }; |
| 72 | |
| 73 | } // namespace Gst |
| 74 | |
| 75 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 76 | namespace Glibcxx . . $ Glib/ |
| 77 | { |
| 78 | |
| 79 | template <> |
| 80 | class Valuecxx . . $ Glib/Value#<Gstcxx . . $ Gst/::TaskStatecxx . . $ Gst/TaskState#> : public Glibcxx . . $ Glib/::Value_Enumcxx . . $ Glib/Value_Enum#<Gstcxx . . $ Gst/::TaskStatecxx . . $ Gst/TaskState#> |
| 81 | { |
| 82 | public: |
| 83 | static GType value_typecxx . . $ Glib/Value#value_type(f708dce9a8856c70).() G_GNUC_CONSTcxx . . $ `gstreamer/gstreamermm/wrap_init.cc:9:9`!; |
| 84 | }; |
| 85 | |
| 86 | } // namespace Glib |
| 87 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 88 | |
| 89 | namespace Gstcxx . . $ Gst/ |
| 90 | { |
| 91 | |
| 92 | |
| 93 | class TaskPoolcxx . . $ Gst/TaskPool#; |
| 94 | |
| 95 | /** A class representing GStreamer streaming threads. |
| 96 | * Gst::Task is used by Gst::Element and Gst::Pad to provide the data passing |
| 97 | * threads in a Gst::Pipeline. |
| 98 | * |
| 99 | * A Gst::Pad will typically start a Gst::Task to push or pull data to/from the |
| 100 | * peer pads. Most source elements start a Gst::Task to push data. In some |
| 101 | * cases a demuxer element can start a Gst::Task to pull data from a peer |
| 102 | * element. This is typically done when the demuxer can perform random access |
| 103 | * on the upstream peer element for improved performance. |
| 104 | * |
| 105 | * Although convenience functions exist on Gst::Pad to start/pause/stop tasks, |
| 106 | * it might sometimes be needed to create a Gst::Task manually if it is not |
| 107 | * related to a Gst::Pad. |
| 108 | * |
| 109 | * Before the Gst::Task can be run, it needs a Glib::StaticRecMutex that can be |
| 110 | * set with set_lock(). |
| 111 | * |
| 112 | * The task can be started, paused and stopped with start(), pause() and stop() |
| 113 | * respectively. |
| 114 | * |
| 115 | * A Gst::Task will repeadedly call the Gst::Task::SlotTask that was provided |
| 116 | * when creating the task with create(). Before calling the function it will |
| 117 | * acquire the provided lock. |
| 118 | * |
| 119 | * Stopping a task with stop() will not immediatly make sure the task is not |
| 120 | * running anymore. Use join() to make sure the task is completely stopped and |
| 121 | * the thread is stopped. |
| 122 | * |
| 123 | * Task functions can send a Gst::Message to send out-of-band data to the |
| 124 | * application. The application can receive messages from the Gst::Bus in its |
| 125 | * mainloop. |
| 126 | * |
| 127 | * For debugging purposes, the task will configure its object name as the thread |
| 128 | * name on Linux. Please note that the object name should be configured before the |
| 129 | * task is started; changing the object name after the task has been started, has |
| 130 | * no effect on the thread name. |
| 131 | * |
| 132 | * Last reviewed on 2015-10-14 (1.5.2) |
| 133 | */ |
| 134 | |
| 135 | class Taskcxx . . $ Gst/Task# : public Objectcxx . . $ Gst/Object# |
| 136 | { |
| 137 | |
| 138 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 139 | |
| 140 | public: |
| 141 | using CppObjectTypecxx . . $ Gst/Task#CppObjectType# = Taskcxx . . $ Gst/Task#; |
| 142 | using CppClassTypecxx . . $ Gst/Task#CppClassType# = Task_Classcxx . . $ Gst/Task_Class#; |
| 143 | using BaseObjectTypecxx . . $ Gst/Task#BaseObjectType# = GstTaskcxx . . $ GstTask#; |
| 144 | using BaseClassTypecxx . . $ Gst/Task#BaseClassType# = GstTaskClasscxx . . $ GstTaskClass#; |
| 145 | |
| 146 | // noncopyable |
| 147 | Taskcxx . . $ Gst/Task#Task(b5db18dbe693acf3).(const Taskcxx . . $ Gst/Task#&) = delete; |
| 148 | Taskcxx . . $ Gst/Task#& operatorcxx . . $ Gst/Task#`operator=`(618da119a390a76c).=(const Taskcxx . . $ Gst/Task#&) = delete; |
| 149 | |
| 150 | private: friend class Task_Classcxx . . $ Gst/Task_Class#; |
| 151 | static CppClassTypecxx . . $ Gst/Task#CppClassType# task_class_cxx . . $ Gst/Task#task_class_.; |
| 152 | |
| 153 | protected: |
| 154 | explicit Taskcxx . . $ Gst/Task#Task(237165b4a42a691a).(const Glibcxx . . $ Glib/::ConstructParamscxx . . $ Glib/ConstructParams#& construct_params); |
| 155 | explicit Taskcxx . . $ Gst/Task#Task(80b42c2d0befce8f).(GstTaskcxx . . $ GstTask#* castitem); |
| 156 | |
| 157 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 158 | |
| 159 | public: |
| 160 | |
| 161 | Taskcxx . . $ Gst/Task#Task(77eb1f2f4eaf6c8).(Taskcxx . . $ Gst/Task#&& src) noexcept; |
| 162 | Taskcxx . . $ Gst/Task#& operatorcxx . . $ Gst/Task#`operator=`(90578c75e7dae747).=(Taskcxx . . $ Gst/Task#&& src) noexcept; |
| 163 | |
| 164 | ~cxx . . $ Gst/Task#`~Task`(ced63f7c635d850d).Taskcxx . . $ Gst/Task#() noexcept override; |
| 165 | |
| 166 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 167 | */ |
| 168 | static GType get_typecxx . . $ Gst/Task#get_type(f708dce9a8856c70).() G_GNUC_CONSTcxx . . $ `<external>/12741050725406041920/gmacros.h:640:9`!; |
| 169 | |
| 170 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 171 | |
| 172 | |
| 173 | static GType get_base_typecxx . . $ Gst/Task#get_base_type(f708dce9a8856c70).() G_GNUC_CONSTcxx . . $ `<external>/12741050725406041920/gmacros.h:640:9`!; |
| 174 | #endif |
| 175 | |
| 176 | ///Provides access to the underlying C GObject. |
| 177 | GstTaskcxx . . $ GstTask#* gobjcxx . . $ Gst/Task#gobj(69decbbe1cbfff1).() { return reinterpret_cast<GstTaskcxx . . $ GstTask#*>(gobject_cxx . . $ Glib/ObjectBase#gobject_.); } |
| 178 | |
| 179 | ///Provides access to the underlying C GObject. |
| 180 | const GstTaskcxx . . $ GstTask#* gobjcxx . . $ Gst/Task#gobj(22f45279cc7526a8).() const { return reinterpret_cast<GstTaskcxx . . $ GstTask#*>(gobject_cxx . . $ Glib/ObjectBase#gobject_.); } |
| 181 | |
| 182 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 183 | GstTaskcxx . . $ GstTask#* gobj_copycxx . . $ Gst/Task#gobj_copy(69decbbe1cbfff1).(); |
| 184 | |
| 185 | private: |
| 186 | |
| 187 | |
| 188 | public: |
| 189 | /** For example, |
| 190 | * void on_do_task();. |
| 191 | */ |
| 192 | typedef sigccxx . . $ sigc/::slotcxx . . $ sigc/slot#<void> SlotTaskcxx . . $ Gst/Task#SlotTask#; |
| 193 | |
| 194 | /** |
| 195 | * Bidirectional slot |
| 196 | */ |
| 197 | typedef sigccxx . . $ sigc/::slotcxx . . $ sigc/slot#<void, const Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Taskcxx . . $ Gst/Task#>&, |
| 198 | Glibcxx . . $ Glib/::Threadscxx . . $ Glib/Threads/::Threadcxx . . $ Glib/Threads/Thread#*> TaskThreadSlotcxx . . $ Gst/Task#TaskThreadSlot#; |
| 199 | /** For example, |
| 200 | * void on_enter(const Glib::RefPtr<Gst::Task>& task, Glib::Threads::Thread& |
| 201 | * thread);. |
| 202 | * A thread is entered, this slot is called when the new thread enters its |
| 203 | * function. |
| 204 | */ |
| 205 | typedef TaskThreadSlotcxx . . $ Gst/Task#TaskThreadSlot# SlotEntercxx . . $ Gst/Task#SlotEnter#; |
| 206 | |
| 207 | /** For example, |
| 208 | * void on_leave(const Glib::RefPtr<Gst::Task>& task, Glib::Threads::Thread& |
| 209 | * thread);. |
| 210 | * A thread is exiting, this is called when the thread is about to leave its |
| 211 | * function. |
| 212 | */ |
| 213 | typedef TaskThreadSlotcxx . . $ Gst/Task#TaskThreadSlot# SlotLeavecxx . . $ Gst/Task#SlotLeave#; |
| 214 | |
| 215 | protected: |
| 216 | explicit Taskcxx . . $ Gst/Task#Task(c89ba1236a12ec8f).(const SlotTaskcxx . . $ Gst/Task#SlotTask#& task_slot); |
| 217 | |
| 218 | public: |
| 219 | /** Create a new Gst::Task that will repeatedly call the provided slot as a |
| 220 | * parameter. Typically the task will run in a new thread. |
| 221 | * |
| 222 | * The slot cannot be changed after the task has been created. You must |
| 223 | * create a new Gst::Task to change the slot. |
| 224 | * |
| 225 | * @param task_slot The Gst::Task::SlotTask to use. |
| 226 | * @return A new Gst::Task. MT safe. |
| 227 | */ |
| 228 | |
| 229 | static Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Taskcxx . . $ Gst/Task#> createcxx . . $ Gst/Task#create(acdb4a9d4875e6a5).(const SlotTaskcxx . . $ Gst/Task#SlotTask#& task_slot); |
| 230 | |
| 231 | |
| 232 | /** Set the mutex used by the task. The mutex will be acquired before |
| 233 | * calling the Gst::TaskFunction. |
| 234 | * |
| 235 | * This function has to be called before calling pause() or |
| 236 | * start(). |
| 237 | * |
| 238 | * MT safe. |
| 239 | * |
| 240 | * @param mutex The RecMutex to use. |
| 241 | */ |
| 242 | void set_lockcxx . . $ Gst/Task#set_lock(ff994652e8ed49be).(Glibcxx . . $ Glib/::Threadscxx . . $ Glib/Threads/::RecMutexcxx . . $ Glib/Threads/RecMutex#& mutex); |
| 243 | |
| 244 | /** Set @a pool as the new GstTaskPool for @a task. Any new streaming threads that |
| 245 | * will be created by @a task will now use @a pool. |
| 246 | * |
| 247 | * MT safe. |
| 248 | * |
| 249 | * @param pool A Gst::TaskPool. |
| 250 | */ |
| 251 | void set_poolcxx . . $ Gst/Task#set_pool(5957d2ab017b193).(const Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::TaskPoolcxx . . $ Gst/TaskPool#>& pool); |
| 252 | |
| 253 | /** Get the Gst::TaskPool that this task will use for its streaming |
| 254 | * threads. |
| 255 | * |
| 256 | * MT safe. |
| 257 | * |
| 258 | * @return The Gst::TaskPool used by @a task. Gst::Object::unref() |
| 259 | * after usage. |
| 260 | */ |
| 261 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::TaskPoolcxx . . $ Gst/TaskPool#> get_poolcxx . . $ Gst/Task#get_pool(b9c7358c4d373e33).(); |
| 262 | |
| 263 | /** Get the Gst::TaskPool that this task will use for its streaming |
| 264 | * threads. |
| 265 | * |
| 266 | * MT safe. |
| 267 | * |
| 268 | * @return The Gst::TaskPool used by @a task. Gst::Object::unref() |
| 269 | * after usage. |
| 270 | */ |
| 271 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<const Gstcxx . . $ Gst/::TaskPoolcxx . . $ Gst/TaskPool#> get_poolcxx . . $ Gst/Task#get_pool(1fe8c3fc67650964).() const; |
| 272 | |
| 273 | /** Call enter_slot when the task function of task is entered. |
| 274 | * |
| 275 | * @param enter_slot |
| 276 | */ |
| 277 | void set_enter_slotcxx . . $ Gst/Task#set_enter_slot(c47c7fb6356781bb).(const SlotEntercxx . . $ Gst/Task#SlotEnter#& enter_slot); |
| 278 | |
| 279 | |
| 280 | /** Call leave_func when the task function of task is left. |
| 281 | * |
| 282 | * @param leave_slot |
| 283 | */ |
| 284 | void set_leave_slotcxx . . $ Gst/Task#set_leave_slot(c47c7fb6356781bb).(const SlotLeavecxx . . $ Gst/Task#SlotLeave#& leave_slot); |
| 285 | |
| 286 | |
| 287 | /** Get the current state of the task. |
| 288 | * |
| 289 | * @return The Gst::TaskState of the task |
| 290 | * |
| 291 | * MT safe. |
| 292 | */ |
| 293 | TaskStatecxx . . $ Gst/TaskState# get_statecxx . . $ Gst/Task#get_state(a96bf2ee13f05779).() const; |
| 294 | |
| 295 | /** Sets the state of @a task to @a state. |
| 296 | * |
| 297 | * The @a task must have a lock associated with it using |
| 298 | * set_lock() when going to GST_TASK_STARTED or GST_TASK_PAUSED or |
| 299 | * this function will return <tt>false</tt>. |
| 300 | * |
| 301 | * MT safe. |
| 302 | * |
| 303 | * @param state The new task state. |
| 304 | * @return <tt>true</tt> if the state could be changed. |
| 305 | */ |
| 306 | void set_statecxx . . $ Gst/Task#set_state(483126772e570f97).(Gstcxx . . $ Gst/::TaskStatecxx . . $ Gst/TaskState# state); |
| 307 | |
| 308 | /** Pauses @a task. This method can also be called on a task in the |
| 309 | * stopped state, in which case a thread will be started and will remain |
| 310 | * in the paused state. This function does not wait for the task to complete |
| 311 | * the paused state. |
| 312 | * |
| 313 | * @return <tt>true</tt> if the task could be paused. |
| 314 | * |
| 315 | * MT safe. |
| 316 | */ |
| 317 | bool pausecxx . . $ Gst/Task#pause(c9857a73d68e59ba).(); |
| 318 | |
| 319 | /** Starts @a task. The @a task must have a lock associated with it using |
| 320 | * set_lock() or this function will return <tt>false</tt>. |
| 321 | * |
| 322 | * @return <tt>true</tt> if the task could be started. |
| 323 | * |
| 324 | * MT safe. |
| 325 | */ |
| 326 | bool startcxx . . $ Gst/Task#start(c9857a73d68e59ba).(); |
| 327 | |
| 328 | /** Stops @a task. This method merely schedules the task to stop and |
| 329 | * will not wait for the task to have completely stopped. Use |
| 330 | * join() to stop and wait for completion. |
| 331 | * |
| 332 | * @return <tt>true</tt> if the task could be stopped. |
| 333 | * |
| 334 | * MT safe. |
| 335 | */ |
| 336 | bool stopcxx . . $ Gst/Task#stop(c9857a73d68e59ba).(); |
| 337 | |
| 338 | /** Joins @a task. After this call, it is safe to unref the task |
| 339 | * and clean up the lock set with set_lock(). |
| 340 | * |
| 341 | * The task will automatically be stopped with this call. |
| 342 | * |
| 343 | * This function cannot be called from within a task function as this |
| 344 | * would cause a deadlock. The function will detect this and print a |
| 345 | * g_warning. |
| 346 | * |
| 347 | * @return <tt>true</tt> if the task could be joined. |
| 348 | * |
| 349 | * MT safe. |
| 350 | */ |
| 351 | bool joincxx . . $ Gst/Task#join(c9857a73d68e59ba).(); |
| 352 | |
| 353 | /** Wait for all tasks to be stopped. This is mainly used internally |
| 354 | * to ensure proper cleanup of internal data structures in test suites. |
| 355 | * |
| 356 | * MT safe. |
| 357 | */ |
| 358 | static void cleanup_allcxx . . $ Gst/Task#cleanup_all(49f6e7a06ebc5aa8).(); |
| 359 | |
| 360 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 361 | private: |
| 362 | // todo this slot should be moved in move constructor, but for now it's |
| 363 | // impossible to provide custom move constructor |
| 364 | // (see https://bugzilla.gnome.org/show_bug.cgi?id=756593). |
| 365 | // However, task should be managed by RefPtr class, so move constructor |
| 366 | // and move assignment operator will never be called. |
| 367 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<SlotTaskcxx . . $ Gst/Task#SlotTask#> m_slotcxx . . $ Gst/Task#m_slot.; |
| 368 | #endif |
| 369 | |
| 370 | |
| 371 | public: |
| 372 | |
| 373 | public: |
| 374 | //C++ methods used to invoke GTK+ virtual functions: |
| 375 | |
| 376 | protected: |
| 377 | //GTK+ Virtual Functions (override these to change behaviour): |
| 378 | |
| 379 | //Default Signal Handlers:: |
| 380 | |
| 381 | |
| 382 | }; |
| 383 | |
| 384 | } // namespace Gst |
| 385 | |
| 386 | |
| 387 | namespace Glibcxx . . $ Glib/ |
| 388 | { |
| 389 | /** A Glib::wrap() method for this object. |
| 390 | * |
| 391 | * @param object The C instance. |
| 392 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 393 | * @result A C++ instance that wraps this C instance. |
| 394 | * |
| 395 | * @relates Gst::Task |
| 396 | */ |
| 397 | Glibcxx . . $ Glib/::RefPtrcxx . . $ Glib/RefPtr#<Gstcxx . . $ Gst/::Taskcxx . . $ Gst/Task#> wrapcxx . . $ Glib/wrap(307007635fa0a143).(GstTaskcxx . . $ GstTask#* object, bool take_copy = false); |
| 398 | } |
| 399 | |
| 400 | |
| 401 | #endif /* _GSTREAMERMM_TASK_H */ |
| 402 |