4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyuntae Kim <ht1211.kim@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef __MM_STREAMRECORDER_ATTRIBUTE_H__
23 #define __MM_STREAMRECORDER_ATTRIBUTE_H__
25 /*=======================================================================================
27 ========================================================================================*/
30 #include <mm_attrs_private.h>
32 #include "mm_streamrecorder_internal.h"
38 /*=======================================================================================
39 | GLOBAL DEFINITIONS AND DECLARATIONS FOR STREAMRECORDER |
40 ========================================================================================*/
42 #define GET_AND_STORE_ATTRS_AFTER_SCENE_MODE
45 /*=======================================================================================
47 ========================================================================================*/
49 * Caster of attributes handle
51 #define MMF_STREAMRECORDER_ATTRS(h) (((mmf_streamrecorder_t *)(h))->attributes)
53 /*=======================================================================================
55 ========================================================================================*/
57 * Enumerations for streamrecorder attribute ID.
60 MM_STR_VIDEO_BUFFER_TYPE, /* 0 */
62 MM_STR_VIDEO_FRAMERATE,
63 MM_STR_VIDEO_ENCODER_BITRATE,
64 MM_STR_VIDEO_RESOLUTION_WIDTH,
65 MM_STR_VIDEO_RESOLUTION_HEIGHT,
67 MM_STR_AUDIO_ENCODER_BITRATE,
68 MM_STR_AUDIO_SAMPLERATE,
70 MM_STR_AUDIO_ENCODER, /* 10 */
71 MM_STR_AUDIO_CHENNEL_COUNT,
73 MM_STR_TARGET_FILE_NAME,
77 MM_STR_TARGET_MAX_SIZE,
78 MM_STR_TARGET_TIME_LIMIT,
80 } MMStreamRecorderAttrsID;
83 /*=======================================================================================
85 ========================================================================================*/
86 typedef bool(*mmf_streamrecorder_commit_func_t) (MMHandleType handle, int attr_idx, const mmf_value_t *value);
88 /*=======================================================================================
89 | STRUCTURE DEFINITIONS |
90 ========================================================================================*/
92 MMStreamRecorderAttrsID attrid;
101 } default_value; /* default value */
102 MMStreamRecorderAttrsValidType validity_type;
106 double *double_array;
114 mmf_streamrecorder_commit_func_t attr_commit;
115 } mm_streamrecorder_attr_construct_info;
117 /*=======================================================================================
118 | CONSTANT DEFINITIONS |
119 ========================================================================================*/
121 /*=======================================================================================
123 ========================================================================================*/
125 /*=======================================================================================
126 | EXTERN GLOBAL VARIABLE |
127 ========================================================================================*/
129 /*=======================================================================================
130 | GLOBAL FUNCTION PROTOTYPES |
131 ========================================================================================*/
133 * This function allocates structure of attributes and sets initial values.
135 * @param[in] handle Handle of streamrecorder.
136 * @param[in] info Preset information of streamrecorder.
137 * @return This function returns allocated structure of attributes.
139 * @see _mmstreamrecorder_dealloc_attribute()
142 MMHandleType _mmstreamrecorder_alloc_attribute(MMHandleType handle);
145 * This function release structure of attributes.
147 * @param[in] attrs Handle of streamrecorder attribute.
150 * @see _mmstreamrecorder_alloc_attribute()
153 void _mmstreamrecorder_dealloc_attribute(MMHandleType attrs);
156 * This is a meta function to get attributes of streamrecorder with given attribute names.
158 * @param[in] handle Handle of streamrecorder.
159 * @param[out] err_attr_name Specifies the name of attributes that made an error. If the function doesn't make an error, this will be null.
160 * @param[in] attribute_name attribute name that user want to get.
161 * @param[in] var_args Specifies variable arguments.
162 * @return This function returns MM_ERROR_NONE on Success, minus on Failure.
163 * @remarks You can retrieve multiple attributes at the same time. @n
164 * @see _mmstreamrecorder_set_attributes
166 int _mmstreamrecorder_get_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
169 * This is a meta function to set attributes of steamrecorder with given attribute names.
171 * @param[in] handle Handle of streamrecorder.
172 * @param[out] err_attr_name Specifies the name of attributes that made an error. If the function doesn't make an error, this will be null.
173 * @param[in] attribute_name attribute name that user want to set.
174 * @param[in] var_args Specifies variable arguments.
175 * @return This function returns MM_ERROR_NONE on Success, minus on Failure.
176 * @remarks You can put multiple attributes to streamrecorder at the same time. @n
177 * @see _mmstreamrecorder_get_attributes
179 int _mmstreamrecorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
182 * This is a meta function to get detail information of the attribute.
184 * @param[in] handle Handle of streamrecorder.
185 * @param[in] attr_name attribute name that user want to get information.
186 * @param[out] info a structure that holds information related with the attribute.
187 * @return This function returns MM_ERROR_NONE on Success, minus on Failure.
188 * @remarks If the function succeeds, 'info' holds detail information about the attribute, such as type, flag, validity_type, validity_values @n
189 * @see _mmstreamrecorder_get_attributes, _mmstreamrecorder_set_attributes
191 int _mmstreamrecorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMStreamRecorderAttrsInfo * info);
193 /*=======================================================================================
194 | STREAMRECORDER INTERNAL LOCAL |
195 ========================================================================================*/
197 * A commit function to set streamrecorder attributes
198 * If the attribute needs actual setting, this function handles that activity.
199 * When application sets an attribute, setting function in MSL common calls this function.
200 * If this function fails, original value will not change.
202 * @param[in] attr_idx Attribute index of subcategory.
203 * @param[in] attr_name Attribute name.
204 * @param[in] value Handle of streamrecorder.
205 * @param[in] commit_param Allocation type of streamrecorder context.
206 * @return This function returns TRUE on success, or FALSE on failure
211 bool _mmstreamrecorder_commit_streamrecorder_attrs(int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param);
213 bool _mmstreamrecorder_commit_video_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
215 bool _mmstreamrecorder_commit_video_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value);
217 bool _mmstreamrecorder_commit_audio_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
219 bool _mmstreamrecorder_commit_audio_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value);
221 bool _mmstreamrecorder_commit_audio_samplingrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
223 bool _mmstreamrecorder_commit_audio_bitformat(MMHandleType handle, int attr_idx, const mmf_value_t *value);
225 bool _mmstreamrecorder_commit_audio_channel(MMHandleType handle, int attr_idx, const mmf_value_t *value);
227 bool _mmstreamrecorder_commit_audio_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
230 * check whether supported or not
232 * @param[in] handle Handle of streamrecorder.
233 * @param[in] attr_index index of attribute to check.
234 * @return bool TRUE if supported or FALSE
236 bool _mmstreamrecorder_check_supported_attribute(MMHandleType handle, int attr_index);
238 bool _mmstreamrecorder_commit_video_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
243 #endif /* __MM_STREAMRECORDER_ATTRIBUTE_H__ */