Finalize basic configuration logic
[staging/agl-audio-plugin.git] / classify.c
1 /*
2  * module-agl-audio -- PulseAudio module for providing audio routing support
3  * (forked from "module-murphy-ivi" - https://github.com/otcshare )
4  * Copyright (c) 2012, Intel Corporation.
5  * Copyright (c) 2016, IoT.bzh
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU Lesser General Public License,
9  * version 2.1, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
19  * MA 02110-1301 USA.
20  *
21  */
22 #include <pulsecore/pulsecore-config.h> /* required for headers below */
23 #include <pulsecore/core-util.h>        /* required for "pa_streq" */
24
25 #include "classify.h"
26
27 agl_node_type agl_classify_guess_stream_node_type (struct userdata *u,  pa_proplist *pl)
28 {
29         agl_node_type type;
30         const char *role;
31
32         pa_assert (u);
33         pa_assert (pl);
34
35         role = pa_proplist_gets (pl, PA_PROP_MEDIA_ROLE);
36
37         if (!role)
38                 type = agl_node_type_unknown;
39         else if (pa_streq (role, "radio"))
40                 type = agl_radio;
41         else if (pa_streq (role, "music"))
42                 type = agl_player;
43         else if (pa_streq (role, "navi"))
44                 type = agl_navigator;
45         else if (pa_streq (role, "game"))
46                 type = agl_game;
47         else if (pa_streq (role, "browser"))
48                 type = agl_browser;
49         else if (pa_streq (role, "camera"))
50                 type = agl_camera;
51         else if (pa_streq (role, "phone"))
52                 type = agl_phone;
53         else if (pa_streq (role, "alert"))
54                 type = agl_alert;
55         else if (pa_streq (role, "event"))
56                 type = agl_event;
57         else if (pa_streq (role, "system"))
58                 type = agl_system;
59         else
60                 type = agl_player;
61
62         return type;
63 }