========================================================================================*/
#include <mm_types.h>
#include <mm_attrs.h>
-#include <mm_attrs_private.h>
#include <stdarg.h>
#include "mm_streamrecorder_internal.h"
/*=======================================================================================
| TYPE DEFINITIONS |
========================================================================================*/
-typedef bool(*mmf_streamrecorder_commit_func_t) (MMHandleType handle, int attr_idx, const mmf_value_t *value);
+typedef bool(*mmf_streamrecorder_commit_func_t) (MMHandleType handle, int attr_idx, const MMAttrsValue *value);
/*=======================================================================================
| STRUCTURE DEFINITIONS |
* @see
*
*/
-bool _mmstreamrecorder_commit_streamrecorder_attrs(int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param);
+bool _mmstreamrecorder_commit_streamrecorder_attrs(int attr_idx, const char *attr_name, const MMAttrsValue *value, void *commit_param);
-bool _mmstreamrecorder_commit_video_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_video_enable(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_video_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_video_encoder(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_audio_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_audio_enable(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_audio_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_audio_encoder(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_audio_samplingrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_audio_samplingrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_audio_bitformat(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_audio_bitformat(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_audio_channel(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_audio_channel(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
-bool _mmstreamrecorder_commit_audio_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_audio_bitrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
/**
* check whether supported or not
*/
bool _mmstreamrecorder_check_supported_attribute(MMHandleType handle, int attr_index);
-bool _mmstreamrecorder_commit_video_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmstreamrecorder_commit_video_bitrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
#ifdef __cplusplus
}
{
MM_STR_VIDEO_BUFFER_TYPE, /* ID */
(char *)"videobuffer-type", /* Name */
- MMF_VALUE_TYPE_INT, /* Type */
+ MM_ATTRS_TYPE_INT, /* Type */
MM_ATTRS_FLAG_RW, /* Flag */
{(void *)MM_STREAMRECORDER_VIDEO_TYPE_TBM_BO}, /* Default value */
MM_ATTRS_VALID_TYPE_INT_RANGE, /* Validity type */
/* 1 */
{MM_STR_VIDEO_FORMAT,
(char *)"videosource-format",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)MM_STREAMRECORDER_INPUT_FORMAT_NV12},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_VIDEO_FRAMERATE,
(char *)"video-framerate",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_VIDEO_ENCODER_BITRATE,
(char *)"video-bitrate",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_VIDEO_RESOLUTION_WIDTH,
(char *)"video-resolution-width",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_ARRAY,
{
MM_STR_VIDEO_RESOLUTION_HEIGHT,
(char *)"video-resolution-height",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_ARRAY,
{
MM_STR_AUDIO_FORMAT,
(char *)"audio-source-format",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)MM_STREAMRECORDER_AUDIO_FORMAT_PCM_S16_LE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_AUDIO_ENCODER_BITRATE,
(char *)"audio-bitrate",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)128000},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_AUDIO_SAMPLERATE,
(char *)"audio-samplerate",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_VIDEO_ENCODER,
(char *)"video-encoder",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_ARRAY,
{
MM_STR_AUDIO_ENCODER,
(char *)"audio-encoder",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_ARRAY,
{
MM_STR_AUDIO_CHENNEL_COUNT,
(char *)"audio-channel-count",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)2},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_FILE_FORMAT,
(char *)"file-format",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_ARRAY,
{
MM_STR_TARGET_FILE_NAME,
(char *)"filename",
- MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
{NULL},
MM_ATTRS_VALID_TYPE_NONE,
{
MM_STR_VIDEO_ENABLE,
(char *)"video-enable",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)FALSE},
MM_ATTRS_VALID_TYPE_NONE,
{
MM_STR_AUDIO_ENABLE,
(char *)"audio-enable",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)FALSE},
MM_ATTRS_VALID_TYPE_NONE,
{
MM_STR_MODE,
(char *)"recorder-mode",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)MM_STREAMRECORDER_MODE_MEDIABUFFER},
MM_ATTRS_VALID_TYPE_NONE,
{
MM_STR_TARGET_MAX_SIZE,
(char *)"target-max-size",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
{
MM_STR_TARGET_TIME_LIMIT,
(char *)"target-time-limit",
- MMF_VALUE_TYPE_INT,
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
#if 0
static bool __mmstreamrecorder_attrs_is_supported(MMHandleType handle, int idx)
{
- mmf_attrs_t *attr = (mmf_attrs_t *) handle;
int flag;
if (mm_attrs_get_flags(handle, idx, &flag) == MM_ERROR_NONE) {
return FALSE;
}
- if (attr->items[idx].value_spec.type == MM_ATTRS_VALID_TYPE_INT_RANGE) {
+ if (mm_attrs_get_valid_type(handle, idx) == MM_ATTRS_VALID_TYPE_INT_RANGE) {
int min, max;
- mm_attrs_get_valid_range((MMHandleType) attr, idx, &min, &max);
+ mm_attrs_get_valid_range(handle, idx, &min, &max);
if (max < min)
return FALSE;
- } else if (attr->items[idx].value_spec.type == MM_ATTRS_VALID_TYPE_INT_ARRAY) {
+ } else if (mm_attrs_get_valid_type(handle, idx) == MM_ATTRS_VALID_TYPE_INT_ARRAY) {
int count;
int *array;
- mm_attrs_get_valid_array((MMHandleType) attr, idx, &count, &array);
+ mm_attrs_get_valid_array(handle, idx, &count, &array);
if (count == 0)
return FALSE;
}
}
/* attribute commiter */
-void __mmstreamrecorder_print_attrs(const char *attr_name, const mmf_value_t * value, const char *cmt_way)
+void __mmstreamrecorder_print_attrs(const char *attr_name, const MMAttrsValue * value, const char *cmt_way)
{
switch (value->type) {
- case MMF_VALUE_TYPE_INT:
+ case MM_ATTRS_TYPE_INT:
_mmstreamrec_dbg_log("%s :(%s:%d)", cmt_way, attr_name, value->value.i_val);
break;
- case MMF_VALUE_TYPE_DOUBLE:
+ case MM_ATTRS_TYPE_DOUBLE:
_mmstreamrec_dbg_log("%s :(%s:%f)", cmt_way, attr_name, value->value.d_val);
break;
- case MMF_VALUE_TYPE_STRING:
+ case MM_ATTRS_TYPE_STRING:
_mmstreamrec_dbg_log("%s :(%s:%s)", cmt_way, attr_name, value->value.s_val);
break;
- case MMF_VALUE_TYPE_DATA:
+ case MM_ATTRS_TYPE_DATA:
_mmstreamrec_dbg_log("%s :(%s:%p)", cmt_way, attr_name, value->value.p_val);
break;
default:
{
_mmstreamrec_dbg_log("");
- MMHandleType attrs = 0;
- mmf_attrs_construct_info_t *attrs_const_info = NULL;
+ MMHandleType attrs = NULL;
+ MMAttrsConstructInfo *attrs_const_info = NULL;
unsigned int attr_count = 0;
unsigned int idx;
+ int ret = MM_ERROR_NONE;
/* Create attribute constructor */
_mmstreamrec_dbg_log("start");
- /* alloc 'mmf_attrs_construct_info_t' */
+ /* alloc 'mm_attrs_construct_info_t' */
attr_count = ARRAY_SIZE(stream_attrs_const_info);
- attrs_const_info = malloc(attr_count * sizeof(mmf_attrs_construct_info_t));
+ attrs_const_info = malloc(attr_count * sizeof(MMAttrsConstructInfo));
if (!attrs_const_info) {
_mmstreamrec_dbg_err("Fail to alloc constructor.");
_mmstreamrec_dbg_log("Create Streamrecorder Attributes[%p, %d]", attrs_const_info, attr_count);
- attrs = mmf_attrs_new_from_data("Streamrecorder_Attributes", attrs_const_info, attr_count, _mmstreamrecorder_commit_streamrecorder_attrs, (void *)handle);
+ ret = mm_attrs_new(attrs_const_info, attr_count, "Streamrecorder_Attributes", _mmstreamrecorder_commit_streamrecorder_attrs, (void *)handle, &attrs);
free(attrs_const_info);
attrs_const_info = NULL;
- if (attrs == 0) {
+ if (ret != MM_ERROR_NONE) {
_mmstreamrec_dbg_err("Fail to alloc attribute handle");
return 0;
}
__mmstreamrecorder_set_conf_to_valid_info(handle);
for (idx = 0; idx < attr_count; idx++) {
- mmf_attrs_set_valid_type(attrs, idx, stream_attrs_const_info[idx].validity_type);
+ mm_attrs_set_valid_type(attrs, idx, stream_attrs_const_info[idx].validity_type);
switch (stream_attrs_const_info[idx].validity_type) {
case MM_ATTRS_VALID_TYPE_INT_ARRAY:
if (stream_attrs_const_info[idx].validity_value_1.int_array &&
stream_attrs_const_info[idx].validity_value_2.count > 0)
- mmf_attrs_set_valid_array(attrs, idx,
+ mm_attrs_set_valid_array(attrs, idx,
(const int *)(stream_attrs_const_info[idx].validity_value_1.int_array),
stream_attrs_const_info[idx].validity_value_2.count,
stream_attrs_const_info[idx].default_value.value_int);
break;
case MM_ATTRS_VALID_TYPE_INT_RANGE:
- mmf_attrs_set_valid_range(attrs, idx,
+ mm_attrs_set_valid_range(attrs, idx,
stream_attrs_const_info[idx].validity_value_1.int_min,
stream_attrs_const_info[idx].validity_value_2.int_max,
stream_attrs_const_info[idx].default_value.value_int);
case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
if (stream_attrs_const_info[idx].validity_value_1.double_array &&
stream_attrs_const_info[idx].validity_value_2.count > 0)
- mmf_attrs_set_valid_double_array(attrs, idx,
+ mm_attrs_set_valid_double_array(attrs, idx,
(const double *)(stream_attrs_const_info[idx].validity_value_1.double_array),
stream_attrs_const_info[idx].validity_value_2.count,
stream_attrs_const_info[idx].default_value.value_double);
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
- mmf_attrs_set_valid_double_range(attrs, idx,
+ mm_attrs_set_valid_double_range(attrs, idx,
stream_attrs_const_info[idx].validity_value_1.double_min,
stream_attrs_const_info[idx].validity_value_2.double_max,
stream_attrs_const_info[idx].default_value.value_double);
_mmstreamrec_dbg_log("");
if (attrs) {
- mmf_attrs_free(attrs);
+ mm_attrs_free(attrs);
_mmstreamrec_dbg_log("released attribute");
}
return ret;
}
-bool _mmstreamrecorder_commit_streamrecorder_attrs(int attr_idx, const char *attr_name, const mmf_value_t * value, void *commit_param)
+bool _mmstreamrecorder_commit_streamrecorder_attrs(int attr_idx, const char *attr_name, const MMAttrsValue * value, void *commit_param)
{
bool bret = FALSE;
return bret;
}
-bool _mmstreamrecorder_commit_video_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_video_enable(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
/* mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle); */
return TRUE;
}
-bool _mmstreamrecorder_commit_video_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_video_encoder(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;
return TRUE;
}
-bool _mmstreamrecorder_commit_audio_enable(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_audio_enable(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
/* mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle); */
return TRUE;
}
-bool _mmstreamrecorder_commit_audio_encoder(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_audio_encoder(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;
return TRUE;
}
-bool _mmstreamrecorder_commit_audio_samplingrate(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_audio_samplingrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;
return TRUE;
}
-bool _mmstreamrecorder_commit_audio_bitformat(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_audio_bitformat(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;
return TRUE;
}
-bool _mmstreamrecorder_commit_video_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_video_bitrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;
return TRUE;
}
-bool _mmstreamrecorder_commit_audio_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_audio_bitrate(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;
return TRUE;
}
-bool _mmstreamrecorder_commit_audio_channel(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmstreamrecorder_commit_audio_channel(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
{
MMHandleType attr = 0;
_MMStreamRecorderSubContext *sc = NULL;