Debian Codegraph @

gstreamer/src/audiobasesink.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 #include <gstreamermm/audioringbuffer.h>
21
22 namespace Gst
23 {
24
25 extern "C"
26 {
27
28 static void AudioBaseSink_CustomSlaving_gstreamermm_callback(GstAudioBaseSink* sink, GstClockTime etime, GstClockTime itime,
29 GstClockTimeDiff *requested_skew, GstAudioBaseSinkDiscontReason discont_reason, gpointer user_data)
30 {
31 Gst::AudioBaseSink::SlotCustomSlaving* the_slot = static_cast<Gst::AudioBaseSink::SlotCustomSlaving*>(user_data);
32 Glib::RefPtr<Gst::AudioBaseSink> sink_wrapper = Glib::wrap(sink, true);
33 try
34 {
35 (*the_slot)(sink_wrapper, static_cast<Gst::ClockTime>(etime), static_cast<Gst::ClockTime>(itime),
36 *requested_skew, static_cast<Gst::AudioBaseSinkDiscontReason>(discont_reason));
37 }
38 catch(...)
39 {
40 Glib::exception_handlers_invoke();
41 }
42 }
43
44 static void AudioBaseSink_CustomSlaving_gstreamermm_callback_disconnect(gpointer data)
45 {
46 Gst::AudioBaseSink::SlotCustomSlaving* the_slot = static_cast<Gst::AudioBaseSink::SlotCustomSlaving*>(data);
47
48 if(the_slot)
49 delete the_slot;
50 }
51
52 }
53
54 void AudioBaseSink::set_custom_slaving_callback(const SlotCustomSlaving& slot)
55 {
56 SlotCustomSlaving *slot_copy = new SlotCustomSlaving(slot);
57
58 return gst_audio_base_sink_set_custom_slaving_callback(gobj(), &AudioBaseSink_CustomSlaving_gstreamermm_callback, slot_copy, &AudioBaseSink_CustomSlaving_gstreamermm_callback_disconnect);
59 }
60
61 }