bdf22baffc1af856d5f4f4d18ac83f7269283c47
[platform/core/api/mediacodec.git] / include / media_codec_ini.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_MEDIA_CODEC_INI_H__
18 #define __TIZEN_MEDIA_CODEC_INI_H__
19
20 #include <glib.h>
21 #include <mm_types.h>
22 #include <media_codec.h>
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define MEDIA_CODEC_INI_DEFAULT_PATH   SYSCONFDIR"/multimedia/mmfw_media_codec.ini"
30 #define MEDIA_CODEC_INI_MAX_STRLEN     256
31 #define MEDIA_CODEC_INI_CNAME_LEN      16
32 #define DEFAULT_PORT "GST_PORT"
33 #define MEDIA_CODEC_MAX_CODEC_TYPE 100
34
35 #define MEDICODEC_INI_MAX_ELEMENT 10
36 #define MEDIA_CODEC_MAX_VIDEO_CODEC 100
37 #define MEDIA_CODEC_MAX_AUDIO_CODEC 100
38
39 typedef struct _codec_list_t codec_list_t;
40 typedef struct _codec_info_t codec_info_t;
41 typedef struct _codec_t codec_t;
42 typedef struct _mc_ini_t mc_ini_t;
43
44 struct _codec_list_t {
45         gchar cname[MEDIA_CODEC_INI_CNAME_LEN];
46         mediacodec_codec_type_e ctype;
47 };
48
49 typedef enum {
50         GST_PORT = 0,
51         FFMPEG_PORT,
52         CUSTOM_PORT,
53 } port_mode;
54
55 typedef enum {
56         MEDIA_CODEC_ROLE_HW_DECODER = 0,
57         MEDIA_CODEC_ROLE_HW_ENCODER,
58         MEDIA_CODEC_ROLE_SW_DECODER,
59         MEDIA_CODEC_ROLE_SW_ENCODER,
60         MEDIA_CODEC_ROLE_MAX
61 } codec_role;
62
63 struct _codec_info_t {
64         gchar name[MEDIA_CODEC_INI_MAX_STRLEN];
65         gchar mime[MEDIA_CODEC_INI_MAX_STRLEN];
66         gchar format[MEDIA_CODEC_INI_MAX_STRLEN];
67 };
68
69 struct _codec_t {
70         gint codec_id;
71         codec_info_t codec_info[MEDIA_CODEC_ROLE_MAX];
72 };
73
74
75 /* @ mark means the item has tested */
76 struct _mc_ini_t {
77         gboolean loaded;
78         gint codec_list;
79         gint num_supported_codecs;
80         port_mode port_type;
81         /* general */
82         gchar port_name[MEDIA_CODEC_INI_MAX_STRLEN];
83         codec_t  codec[MEDIA_CODEC_MAX_CODEC_TYPE];
84 };
85
86 /*Default sink ini values*/
87 /* General*/
88
89 /* NOTE : following content should be same with above default values */
90 /* FIXIT : need smarter way to generate default ini file. */
91 /* FIXIT : finally, it should be an external file */
92 #define MEDIA_CODEC_DEFAULT_INI \
93 "\
94 [general] \n\
95 \n\
96 ;Add general config parameters here\n\
97 \n\
98 \n\
99 \n\
100 [port_in_use] \n\
101 \n\
102 ;media_codec_port = GST_PORT \n\
103 ;media_codec_port = FFMPEG_PORT \n\
104 ;media_codec_port = CUSTOM_PORT \n\
105 media_codec_port = GST_PORT \n\
106 \n\
107 [gst_port] \n\
108 \n\
109 ;Add gst port specific config paramters here\n\
110 \n\
111 \n\
112 [custom_port] \n\
113 \n\
114 ;Add custom port specific config paramters here\n\
115 \n\
116 \n\
117 \n\
118 "
119
120 extern mc_ini_t mc_ini;
121
122 int mc_ini_load(mc_ini_t *ini);
123 media_format_mimetype_e _mc_convert_media_format_str_to_int(char *sformat);
124
125
126 #ifdef __cplusplus
127 }
128 #endif
129 #endif /*__TIZEN_MEDIA_CODEC_INI_H__*/