1 /* GStreamer 2 * Copyright (C) 2021 Seungha Yang <seungha@centricular.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License aglong with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GST_ASIO_OBJECT_H__ 21 #define __GST_ASIO_OBJECT_H__ 22 23 #include <gst/gst.h> 24 #include <windows.h> 25 #include "gstasioutils.h" 26 27 G_BEGIN_DECLS 28 29 #define GST_TYPE_ASIO_OBJECT (gst_asio_object_get_type()) 30 G_DECLARE_FINAL_TYPE (GstAsioObject, gst_asio_object, 31 GST, ASIO_OBJECT, GstObject); 32 33 typedef struct { 34 gboolean (*buffer_switch) (GstAsioObject * obj, 35 glong index, 36 ASIOBufferInfo * infos, 37 guint num_infos, 38 ASIOChannelInfo * input_channel_infos, 39 ASIOChannelInfo * output_channel_infos, 40 ASIOSampleRate sample_rate, 41 glong buffer_size, 42 ASIOTime * time_info, 43 gpointer user_data); 44 45 gpointer user_data; 46 } GstAsioObjectCallbacks; 47 48 typedef enum 49 { 50 GST_ASIO_DEVICE_CLASS_CAPTURE, 51 GST_ASIO_DEVICE_CLASS_RENDER, 52 GST_ASIO_DEVICE_CLASS_LOOPBACK_CAPTURE, 53 } GstAsioDeviceClassType; 54 55 GstAsioObject * gst_asio_object_new (const GstAsioDeviceInfo * info, 56 gboolean occupy_all_channels); 57 58 GstCaps * gst_asio_object_get_caps (GstAsioObject * obj, 59 GstAsioDeviceClassType type, 60 guint num_min_channels, 61 guint num_max_channels); 62 63 gboolean gst_asio_object_create_buffers (GstAsioObject * obj, 64 GstAsioDeviceClassType type, 65 guint * channel_indices, 66 guint num_channels, 67 guint * buffer_size); 68 69 gboolean gst_asio_object_start (GstAsioObject * obj); 70 71 gboolean gst_asio_object_install_callback (GstAsioObject * obj, 72 GstAsioDeviceClassType type, 73 GstAsioObjectCallbacks * callbacks, 74 guint64 * callback_id); 75 76 void gst_asio_object_uninstall_callback (GstAsioObject * obj, 77 guint64 callback_id); 78 79 gboolean gst_asio_object_get_max_num_channels (GstAsioObject * obj, 80 glong * num_input_ch, 81 glong * num_output_ch); 82 83 gboolean gst_asio_object_get_buffer_size (GstAsioObject * obj, 84 glong * min_size, 85 glong * max_size, 86 glong * preferred_size, 87 glong * granularity); 88 89 gboolean gst_asio_object_get_latencies (GstAsioObject * obj, 90 glong * input_latency, 91 glong * output_latency); 92 93 gboolean gst_asio_object_can_sample_rate (GstAsioObject * obj, 94 ASIOSampleRate sample_rate); 95 96 gboolean gst_asio_object_get_sample_rate (GstAsioObject * obj, 97 ASIOSampleRate * sample_rate); 98 99 gboolean gst_asio_object_set_sample_rate (GstAsioObject * obj, 100 ASIOSampleRate sample_rate); 101 102 G_END_DECLS 103 104 #endif /* __GST_ASIO_OBJECT_H__ */