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;
103 int validity_value1; /* can be int min, int *array, double *array, or cast to double min. */
104 int validity_value2; /* can be int max, int count, int count, or cast to double max. */
105 mmf_streamrecorder_commit_func_t attr_commit;
106 } mm_streamrecorder_attr_construct_info;
108 /*=======================================================================================
109 | CONSTANT DEFINITIONS |
110 ========================================================================================*/
112 /*=======================================================================================
114 ========================================================================================*/
116 /*=======================================================================================
117 | EXTERN GLOBAL VARIABLE |
118 ========================================================================================*/
120 /*=======================================================================================
121 | GLOBAL FUNCTION PROTOTYPES |
122 ========================================================================================*/
124 * This function allocates structure of attributes and sets initial values.
126 * @param[in] handle Handle of streamrecorder.
127 * @param[in] info Preset information of streamrecorder.
128 * @return This function returns allocated structure of attributes.
130 * @see _mmstreamrecorder_dealloc_attribute()
133 MMHandleType _mmstreamrecorder_alloc_attribute(MMHandleType handle);
136 * This function release structure of attributes.
138 * @param[in] attrs Handle of streamrecorder attribute.
141 * @see _mmstreamrecorder_alloc_attribute()
144 void _mmstreamrecorder_dealloc_attribute(MMHandleType attrs);
147 * This is a meta function to get attributes of streamrecorder with given attribute names.
149 * @param[in] handle Handle of streamrecorder.
150 * @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.
151 * @param[in] attribute_name attribute name that user want to get.
152 * @param[in] var_args Specifies variable arguments.
153 * @return This function returns MM_ERROR_NONE on Success, minus on Failure.
154 * @remarks You can retrieve multiple attributes at the same time. @n
155 * @see _mmstreamrecorder_set_attributes
157 int _mmstreamrecorder_get_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
160 * This is a meta function to set attributes of steamrecorder with given attribute names.
162 * @param[in] handle Handle of streamrecorder.
163 * @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.
164 * @param[in] attribute_name attribute name that user want to set.
165 * @param[in] var_args Specifies variable arguments.
166 * @return This function returns MM_ERROR_NONE on Success, minus on Failure.
167 * @remarks You can put multiple attributes to streamrecorder at the same time. @n
168 * @see _mmstreamrecorder_get_attributes
170 int _mmstreamrecorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
173 * This is a meta function to get detail information of the attribute.
175 * @param[in] handle Handle of streamrecorder.
176 * @param[in] attr_name attribute name that user want to get information.
177 * @param[out] info a structure that holds information related with the attribute.
178 * @return This function returns MM_ERROR_NONE on Success, minus on Failure.
179 * @remarks If the function succeeds, 'info' holds detail information about the attribute, such as type, flag, validity_type, validity_values @n
180 * @see _mmstreamrecorder_get_attributes, _mmstreamrecorder_set_attributes
182 int _mmstreamrecorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMStreamRecorderAttrsInfo * info);
184 /*=======================================================================================
185 | STREAMRECORDER INTERNAL LOCAL |
186 ========================================================================================*/
188 * A commit function to set streamrecorder attributes
189 * If the attribute needs actual setting, this function handles that activity.
190 * When application sets an attribute, setting function in MSL common calls this function.
191 * If this function fails, original value will not change.
193 * @param[in] attr_idx Attribute index of subcategory.
194 * @param[in] attr_name Attribute name.
195 * @param[in] value Handle of streamrecorder.
196 * @param[in] commit_param Allocation type of streamrecorder context.
197 * @return This function returns TRUE on success, or FALSE on failure
202 bool _mmstreamrecorder_commit_streamrecorder_attrs(int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param);
204 bool _mmstreamrecorder_commit_video_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
206 bool _mmstreamrecorder_commit_video_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value);
208 bool _mmstreamrecorder_commit_audio_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
210 bool _mmstreamrecorder_commit_audio_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value);
212 bool _mmstreamrecorder_commit_audio_samplingrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
214 bool _mmstreamrecorder_commit_audio_bitformat(MMHandleType handle, int attr_idx, const mmf_value_t *value);
216 bool _mmstreamrecorder_commit_audio_channel(MMHandleType handle, int attr_idx, const mmf_value_t *value);
218 bool _mmstreamrecorder_commit_audio_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
221 * check whether supported or not
223 * @param[in] handle Handle of streamrecorder.
224 * @param[in] attr_index index of attribute to check.
225 * @return bool TRUE if supported or FALSE
227 bool _mmstreamrecorder_check_supported_attribute(MMHandleType handle, int attr_index);
230 * mm_streamrecorder_get_attribute_info:\n
231 * Get detail information of the attribute. To manager attributes, an user may want to know the exact character of the attribute,
232 * such as type, flag, and validity. This is the function to provide such information.
233 * Depending on the 'validity_type', validity union would be different. To know about the type of union, please refer 'MMStreamRecorderAttrsInfo'.
235 * @param[in] streamrecorder Specifies the streamrecorder handle.
236 * @param[in] attribute_name attribute name that user want to get information.
237 * @param[out] info a structure that holds information related with the attribute.
238 * @return This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
239 * Please refer 'mm_error.h' to know the exact meaning of the error.
242 * @remarks If the function succeeds, 'info' holds detail information about the attribute, such as type,
243 * flag, validity_type, validity_values, and default values.
244 * @see mm_streamrecorder_get_attributes, mm_streamrecorder_set_attributes
247 int mm_streamrecorder_get_attribute_info(MMHandleType streamrecorder, const char *attribute_name, MMStreamRecorderAttrsInfo *info);
249 bool _mmstreamrecorder_commit_video_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
254 #endif /* __MM_STREAMRECORDER_ATTRIBUTE_H__ */