2 * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
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.
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.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_WASAPI_UTIL_H__
21 #define __GST_WASAPI_UTIL_H__
24 #include <gst/audio/audio.h>
25 #include <gst/audio/gstaudiosrc.h>
26 #include <gst/audio/gstaudiosink.h>
28 #include <mmdeviceapi.h>
29 #include <audioclient.h>
31 /* Static Caps shared between source, sink, and device provider */
32 #define GST_WASAPI_STATIC_CAPS "audio/x-raw, " \
33 "format = (string) " GST_AUDIO_FORMATS_ALL ", " \
34 "layout = (string) interleaved, " \
35 "rate = " GST_AUDIO_RATE_RANGE ", " \
36 "channels = " GST_AUDIO_CHANNELS_RANGE
38 /* Device role enum property */
41 GST_WASAPI_DEVICE_ROLE_CONSOLE,
42 GST_WASAPI_DEVICE_ROLE_MULTIMEDIA,
43 GST_WASAPI_DEVICE_ROLE_COMMS
44 } GstWasapiDeviceRole;
45 #define GST_WASAPI_DEVICE_TYPE_ROLE (gst_wasapi_device_role_get_type())
46 GType gst_wasapi_device_role_get_type (void);
50 gint gst_wasapi_device_role_to_erole (gint role);
52 gint gst_wasapi_erole_to_device_role (gint erole);
54 gchar *gst_wasapi_util_hresult_to_string (HRESULT hr);
56 gboolean gst_wasapi_util_get_devices (GstElement * element, gboolean active,
59 gboolean gst_wasapi_util_get_device_client (GstElement * element,
60 gboolean capture, gint role, const wchar_t * device_strid,
61 IMMDevice ** ret_device, IAudioClient ** ret_client);
63 gboolean gst_wasapi_util_get_device_format (GstElement * element,
64 gint device_mode, IMMDevice * device, IAudioClient * client,
65 WAVEFORMATEX ** ret_format);
67 gboolean gst_wasapi_util_get_render_client (GstElement * element,
68 IAudioClient * client, IAudioRenderClient ** ret_render_client);
70 gboolean gst_wasapi_util_get_capture_client (GstElement * element,
71 IAudioClient * client, IAudioCaptureClient ** ret_capture_client);
73 gboolean gst_wasapi_util_get_clock (GstElement * element,
74 IAudioClient * client, IAudioClock ** ret_clock);
76 gboolean gst_wasapi_util_parse_waveformatex (WAVEFORMATEXTENSIBLE * format,
77 GstCaps * template_caps, GstCaps ** out_caps,
78 GstAudioChannelPosition ** out_positions);
80 void gst_wasapi_util_get_best_buffer_sizes (GstAudioRingBufferSpec * spec,
81 gboolean exclusive, REFERENCE_TIME default_period,
82 REFERENCE_TIME min_period, REFERENCE_TIME * ret_period,
83 REFERENCE_TIME * ret_buffer_duration);
85 #endif /* __GST_WASAPI_UTIL_H__ */