Merge "Removed unused result variable from sound_codec_asm_callback" into tizen
[platform/core/multimedia/libmm-sound.git] / server / mm_sound_mgr_hdmi.c
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <stdlib.h>
23 #include <string.h>
24
25 #include <pthread.h>
26 #include <sys/shm.h>
27 #include <sys/msg.h>
28 #include <sys/mman.h>
29 #include <sys/stat.h>
30 #include <fcntl.h>
31 #include <stdbool.h>
32
33 #include <errno.h>
34
35 #include "include/mm_sound_mgr_common.h"
36 #include "../include/mm_sound_common.h"
37
38 #include <mm_error.h>
39 #include <mm_debug.h>
40
41 #include "include/mm_sound_mgr_hdmi.h"
42 #include "include/mm_sound_mgr_session.h"
43
44 /******************************* HDMI Code **********************************/
45
46 #include "mm_sound.h"
47
48 #include <vconf.h>
49 #include <vconf-keys.h>
50
51
52 /* HDMI status value from system server */
53 static void _hdmi_status_changed_cb(keynode_t* node, void* data)
54 {
55         int hdmi_available = 0;
56
57         /* Get actual vconf value */
58         vconf_get_int(VCONFKEY_SYSMAN_HDMI, &hdmi_available);
59
60         debug_msg ("[%s] changed callback called\n", vconf_keynode_get_name(node));
61         debug_msg ("HDMI : [%s]=[%d]\n",
62                         VCONFKEY_SYSMAN_HDMI, hdmi_available);
63
64         MMSoundMgrSessionSetDeviceAvailable (DEVICE_HDMI, hdmi_available, 0, NULL);
65 }
66
67 static int _register_hdmi_status(void)
68 {
69         /* set callback for vconf key change */
70         int ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_HDMI, _hdmi_status_changed_cb, NULL);
71         debug_msg ("vconf [%s] set ret = [%d]\n", VCONFKEY_SYSMAN_HDMI, ret);
72         return ret;
73 }
74
75 int MMSoundMgrHdmiInit(void)
76 {
77         debug_enter("\n");
78
79         if (_register_hdmi_status() != 0) {
80                 debug_error ("Registering hdmi status failed\n");
81                 return MM_ERROR_SOUND_INTERNAL;
82         }
83
84         debug_leave("\n");
85         return MM_ERROR_NONE;
86 }
87
88 int MMSoundMgrHdmiFini(void)
89 {
90         debug_enter("\n");
91
92         debug_leave("\n");
93         return MM_ERROR_NONE;
94 }
95