| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/task.h> |
| 7 | #include <gstreamermm/private/task_p.h> |
| 8 | |
| 9 | |
| 10 | /* gstreamermm - a C++ wrapper for gstreamer |
| 11 | * |
| 12 | * Copyright 2008 The gstreamermm Development Team |
| 13 | * |
| 14 | * This library is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU Lesser General Public |
| 16 | * License as published by the Free Software Foundation; either |
| 17 | * version 2.1 of the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This library is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | * Lesser General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU Lesser General Public |
| 25 | * License along with this library; if not, write to the Free |
| 26 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | */ |
| 28 | |
| 29 | #include <gst/gst.h> |
| 30 | #include <gstreamermm/taskpool.h> |
| 31 | |
| 32 | |
| 33 | namespace |
| 34 | { |
| 35 | |
| 36 | extern "C" |
| 37 | { |
| 38 | |
| 39 | static void Task_Task_gstreamermm_callback(void* data) |
| 40 | { |
| 41 | Gst::Task::SlotTask* the_slot = static_cast<Gst::Task::SlotTask*>(data); |
| 42 | |
| 43 | try |
| 44 | { |
| 45 | (*the_slot)(); |
| 46 | } |
| 47 | catch(...) |
| 48 | { |
| 49 | Glib::exception_handlers_invoke(); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | static void Task_Thread_gstreamermm_callback(GstTask* task, GThread* thread, gpointer user_data) |
| 54 | { |
| 55 | Gst::Task::TaskThreadSlot* the_slot = static_cast<Gst::Task::TaskThreadSlot*>(user_data); |
| 56 | |
| 57 | try |
| 58 | { |
| 59 | (*the_slot)(Glib::wrap(task, true), Glib::Threads::wrap(thread)); |
| 60 | } |
| 61 | catch(...) |
| 62 | { |
| 63 | Glib::exception_handlers_invoke(); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | static void Task_Callbacks_gstreamermm_callback_destroy(void* data) |
| 68 | { |
| 69 | delete static_cast<Gst::Task::TaskThreadSlot*>(data); |
| 70 | } |
| 71 | |
| 72 | } // extern "C" |
| 73 | |
| 74 | } // anonymous namespace |
| 75 | |
| 76 | namespace Gst |
| 77 | { |
| 78 | |
| 79 | Task::Task(const SlotTask& task_slot) |
| 80 | : |
| 81 | // Mark this class as non-derived to allow C++ vfuncs to be skipped. |
| 82 | Glib::ObjectBase(nullptr), |
| 83 | Object(Glib::ConstructParams(task_class_.init())) |
| 84 | { |
| 85 | // Create a copy of the slot. A pointer to this copy will be passed through |
| 86 | // the call back's data parameter. It will be destroyed with the |
| 87 | // std::unique_ptr<>. |
| 88 | m_slot.reset(new SlotTask(task_slot)); |
| 89 | |
| 90 | // These lines are taken verbatim from gst_task_create() after calling |
| 91 | // g_object_new(). |
| 92 | gobj()->func = &Task_Task_gstreamermm_callback; |
| 93 | gobj()->user_data = m_slot.get(); |
| 94 | } |
| 95 | |
| 96 | void Task::set_leave_slot(const SlotLeave& leave_slot) |
| 97 | { |
| 98 | gst_task_set_leave_callback(gobj(), &Task_Thread_gstreamermm_callback, new SlotLeave(leave_slot), &Task_Callbacks_gstreamermm_callback_destroy); |
| 99 | } |
| 100 | |
| 101 | void Task::set_enter_slot(const SlotEnter& enter_slot) |
| 102 | { |
| 103 | gst_task_set_enter_callback(gobj(), &Task_Thread_gstreamermm_callback, new SlotEnter(enter_slot), &Task_Callbacks_gstreamermm_callback_destroy); |
| 104 | } |
| 105 | |
| 106 | } //namespace Gst |
| 107 | |
| 108 | namespace |
| 109 | { |
| 110 | } // anonymous namespace |
| 111 | |
| 112 | // static |
| 113 | GType Glib::Value<Gst::TaskState>::value_type() |
| 114 | { |
| 115 | return gst_task_state_get_type(); |
| 116 | } |
| 117 | |
| 118 | |
| 119 | namespace Glib |
| 120 | { |
| 121 | |
| 122 | Glib::RefPtr<Gst::Task> wrap(GstTask* object, bool take_copy) |
| 123 | { |
| 124 | return Glib::RefPtr<Gst::Task>( dynamic_cast<Gst::Task*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); |
| 125 | //We use dynamic_cast<> in case of multiple inheritance. |
| 126 | } |
| 127 | |
| 128 | } /* namespace Glib */ |
| 129 | |
| 130 | |
| 131 | namespace Gst |
| 132 | { |
| 133 | |
| 134 | |
| 135 | /* The *_Class implementation: */ |
| 136 | |
| 137 | const Glib::Class& Task_Class::init() |
| 138 | { |
| 139 | if(!gtype_) // create the GType if necessary |
| 140 | { |
| 141 | // Glib::Class has to know the class init function to clone custom types. |
| 142 | class_init_func_ = &Task_Class::class_init_function; |
| 143 | |
| 144 | // This is actually just optimized away, apparently with no harm. |
| 145 | // Make sure that the parent type has been created. |
| 146 | //CppClassParent::CppObjectType::get_type(); |
| 147 | |
| 148 | // Create the wrapper type, with the same class/instance size as the base type. |
| 149 | register_derived_type(gst_task_get_type()); |
| 150 | |
| 151 | // Add derived versions of interfaces, if the C type implements any interfaces: |
| 152 | |
| 153 | } |
| 154 | |
| 155 | return *this; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | void Task_Class::class_init_function(void* g_class, void* class_data) |
| 160 | { |
| 161 | const auto klass = static_cast<BaseClassType*>(g_class); |
| 162 | CppClassParent::class_init_function(klass, class_data); |
| 163 | |
| 164 | |
| 165 | } |
| 166 | |
| 167 | |
| 168 | Glib::ObjectBase* Task_Class::wrap_new(GObject* object) |
| 169 | { |
| 170 | return new Task((GstTask*)object); |
| 171 | } |
| 172 | |
| 173 | |
| 174 | /* The implementation: */ |
| 175 | |
| 176 | GstTask* Task::gobj_copy() |
| 177 | { |
| 178 | reference(); |
| 179 | return gobj(); |
| 180 | } |
| 181 | |
| 182 | Task::Task(const Glib::ConstructParams& construct_params) |
| 183 | : |
| 184 | Object(construct_params) |
| 185 | { |
| 186 | |
| 187 | } |
| 188 | |
| 189 | Task::Task(GstTask* castitem) |
| 190 | : |
| 191 | Object((GstObject*)(castitem)) |
| 192 | {} |
| 193 | |
| 194 | |
| 195 | Task::Task(Task&& src) noexcept |
| 196 | : Object(std::move(src)) |
| 197 | {} |
| 198 | |
| 199 | Task& Task::operator=(Task&& src) noexcept |
| 200 | { |
| 201 | Object::operator=(std::move(src)); |
| 202 | return *this; |
| 203 | } |
| 204 | |
| 205 | |
| 206 | Task::~Task() noexcept |
| 207 | {} |
| 208 | |
| 209 | |
| 210 | Task::CppClassType Task::task_class_; // initialize static member |
| 211 | |
| 212 | GType Task::get_type() |
| 213 | { |
| 214 | return task_class_.init().get_type(); |
| 215 | } |
| 216 | |
| 217 | |
| 218 | GType Task::get_base_type() |
| 219 | { |
| 220 | return gst_task_get_type(); |
| 221 | } |
| 222 | |
| 223 | |
| 224 | Glib::RefPtr<Task> Task::create(const SlotTask& task_slot) |
| 225 | { |
| 226 | return Glib::RefPtr<Task>( new Task(task_slot) ); |
| 227 | } |
| 228 | |
| 229 | void Task::set_lock(Glib::Threads::RecMutex& mutex) |
| 230 | { |
| 231 | gst_task_set_lock(gobj(), mutex.gobj()); |
| 232 | } |
| 233 | |
| 234 | void Task::set_pool(const Glib::RefPtr<Gst::TaskPool>& pool) |
| 235 | { |
| 236 | gst_task_set_pool(gobj(), Glib::unwrap(pool)); |
| 237 | } |
| 238 | |
| 239 | Glib::RefPtr<Gst::TaskPool> Task::get_pool() |
| 240 | { |
| 241 | return Glib::wrap(gst_task_get_pool(gobj())); |
| 242 | } |
| 243 | |
| 244 | Glib::RefPtr<const Gst::TaskPool> Task::get_pool() const |
| 245 | { |
| 246 | return Glib::wrap(gst_task_get_pool(const_cast<GstTask*>(gobj()))); |
| 247 | } |
| 248 | |
| 249 | TaskState Task::get_state() const |
| 250 | { |
| 251 | return ((TaskState)(gst_task_get_state(const_cast<GstTask*>(gobj())))); |
| 252 | } |
| 253 | |
| 254 | void Task::set_state(Gst::TaskState state) |
| 255 | { |
| 256 | gst_task_set_state(gobj(), ((GstTaskState)(state))); |
| 257 | } |
| 258 | |
| 259 | bool Task::pause() |
| 260 | { |
| 261 | return gst_task_pause(gobj()); |
| 262 | } |
| 263 | |
| 264 | bool Task::start() |
| 265 | { |
| 266 | return gst_task_start(gobj()); |
| 267 | } |
| 268 | |
| 269 | bool Task::stop() |
| 270 | { |
| 271 | return gst_task_stop(gobj()); |
| 272 | } |
| 273 | |
| 274 | bool Task::join() |
| 275 | { |
| 276 | return gst_task_join(gobj()); |
| 277 | } |
| 278 | |
| 279 | void Task::cleanup_all() |
| 280 | { |
| 281 | gst_task_cleanup_all(); |
| 282 | } |
| 283 | |
| 284 | |
| 285 | } // namespace Gst |
| 286 | |
| 287 |