2 * Copyright (C) 2015 Centricular Ltd.,
3 * Arun Raghavan <mail@arunraghavan.net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
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 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #include "openslescommon.h"
23 #ifndef SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION
24 /* This was added in Android API level 14 */
25 #define SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION ((SLuint32) 0x00000004)
29 gst_opensles_recording_preset_get_type (void)
31 static const GEnumValue values[] = {
32 {GST_OPENSLES_RECORDING_PRESET_NONE,
33 "GST_OPENSLES_RECORDING_PRESET_NONE", "none"},
34 {GST_OPENSLES_RECORDING_PRESET_GENERIC,
35 "GST_OPENSLES_RECORDING_PRESET_GENERIC", "generic"},
36 {GST_OPENSLES_RECORDING_PRESET_CAMCORDER,
37 "GST_OPENSLES_RECORDING_PRESET_CAMCORDER", "camcorder"},
38 {GST_OPENSLES_RECORDING_PRESET_VOICE_RECOGNITION,
39 "GST_OPENSLES_RECORDING_PRESET_VOICE_RECOGNITION", "voice-recognition"},
40 {GST_OPENSLES_RECORDING_PRESET_VOICE_COMMUNICATION,
41 "GST_OPENSLES_RECORDING_PRESET_VOICE_COMMUNICATION",
42 "voice-communication"},
47 if (g_once_init_enter ((gsize *) & id)) {
50 _id = g_enum_register_static ("GstOpenSLESRecordingPreset", values);
52 g_once_init_leave ((gsize *) & id, _id);
59 gst_to_opensles_recording_preset (GstOpenSLESRecordingPreset preset)
62 case GST_OPENSLES_RECORDING_PRESET_NONE:
63 return SL_ANDROID_RECORDING_PRESET_NONE;
65 case GST_OPENSLES_RECORDING_PRESET_GENERIC:
66 return SL_ANDROID_RECORDING_PRESET_GENERIC;
68 case GST_OPENSLES_RECORDING_PRESET_CAMCORDER:
69 return SL_ANDROID_RECORDING_PRESET_CAMCORDER;
71 case GST_OPENSLES_RECORDING_PRESET_VOICE_RECOGNITION:
72 return SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
74 case GST_OPENSLES_RECORDING_PRESET_VOICE_COMMUNICATION:
75 return SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION;
78 GST_ERROR ("Unsupported preset: %d", (int) preset);
79 return SL_ANDROID_RECORDING_PRESET_NONE;
84 gst_opensles_stream_type_get_type (void)
86 static const GEnumValue values[] = {
87 {GST_OPENSLES_STREAM_TYPE_VOICE,
88 "GST_OPENSLES_STREAM_TYPE_VOICE", "voice"},
89 {GST_OPENSLES_STREAM_TYPE_SYSTEM,
90 "GST_OPENSLES_STREAM_TYPE_SYSTEM", "system"},
91 {GST_OPENSLES_STREAM_TYPE_RING,
92 "GST_OPENSLES_STREAM_TYPE_RING", "ring"},
93 {GST_OPENSLES_STREAM_TYPE_MEDIA,
94 "GST_OPENSLES_STREAM_TYPE_MEDIA", "media"},
95 {GST_OPENSLES_STREAM_TYPE_ALARM,
96 "GST_OPENSLES_STREAM_TYPE_ALARM", "alarm"},
97 {GST_OPENSLES_STREAM_TYPE_NOTIFICATION,
98 "GST_OPENSLES_STREAM_TYPE_NOTIFICATION", "notification"},
99 {GST_OPENSLES_STREAM_TYPE_NONE,
100 "GST_OPENSLES_STREAM_TYPE_NONE", "none"},
105 if (g_once_init_enter ((gsize *) & id)) {
108 _id = g_enum_register_static ("GstOpenSLESStreamType", values);
110 g_once_init_leave ((gsize *) & id, _id);
118 gst_to_opensles_stream_type (GstOpenSLESStreamType stream_type)
120 switch (stream_type) {
121 case GST_OPENSLES_STREAM_TYPE_VOICE:
122 return SL_ANDROID_STREAM_VOICE;
124 case GST_OPENSLES_STREAM_TYPE_SYSTEM:
125 return SL_ANDROID_STREAM_SYSTEM;
127 case GST_OPENSLES_STREAM_TYPE_RING:
128 return SL_ANDROID_STREAM_RING;
130 case GST_OPENSLES_STREAM_TYPE_MEDIA:
131 return SL_ANDROID_STREAM_MEDIA;
133 case GST_OPENSLES_STREAM_TYPE_ALARM:
134 return SL_ANDROID_STREAM_ALARM;
136 case GST_OPENSLES_STREAM_TYPE_NOTIFICATION:
137 return SL_ANDROID_STREAM_NOTIFICATION;
140 GST_ERROR ("Unsupported stream type: %d", (int) stream_type);
141 return SL_ANDROID_STREAM_MEDIA;