Debian Codegraph @

gstreamer/src/clock.ccg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 _PINCLUDE(gstreamermm/private/object_p.h)
21
22 namespace
23 {
24
25 extern "C"
26 {
27
28 static gboolean ClockID_Clock_gstreamermm_callback(GstClock* clock, GstClockTime time, GstClockID id, void* data)
29 {
30 Gst::ClockID::SlotClock* the_slot = static_cast<Gst::ClockID::SlotClock*>(data);
31
32 try
33 {
34 bool result = (*the_slot)(Glib::wrap(clock, true), time,
35 Glib::wrap(reinterpret_cast<GstClockEntry*>(id), true));
36
37 //Delete the once executing slot before returning result
38 delete the_slot;
39
40 return result;
41 }
42 catch(...)
43 {
44 Glib::exception_handlers_invoke();
45 }
46
47 return false;
48 }
49
50
51 static void ClockID_Clock_gstreamermm_callback_destroy(void* data)
52 {
53 delete static_cast<Gst::ClockID::SlotClock*>(data);
54 }
55
56 } // extern "C"
57
58 } // anonymous namespace
59
60 namespace Gst
61 {
62
63 ClockReturn ClockID::wait_async(const SlotClock& slot)
64 {
65 SlotClock* slot_copy = new SlotClock(slot);
66 return static_cast<ClockReturn>(gst_clock_id_wait_async(gobj(), &ClockID_Clock_gstreamermm_callback, slot_copy, &ClockID_Clock_gstreamermm_callback_destroy));
67 }
68
69 }