| |
========================================================================================== */
-/*---------------------------------------------------------------------------
-| LOCAL FUNCTION PROTOTYPES: |
----------------------------------------------------------------------------*/
-int
-__mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name);
+/*-----------------------------------------------------------------------
+| LOCAL FUNCTION PROTOTYPES: |
+-----------------------------------------------------------------------*/
+static bool __mmplayer_commit_gapless_mode(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
+static bool __mmplayer_commit_enable_video_decoded_cb(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
+static bool __mmplayer_commit_audio_pitch_value(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
/*===========================================================================================
| |
| |
========================================================================================== */
-int
-_mmplayer_get_attribute(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list args_list)
+static bool __mmplayer_commit_enable_video_decoded_cb(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+ mmplayer_gst_element_t *videobin = NULL;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && value, false);
+
+ if (!_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_NUM)) {
+ LOGD("will be applied when videosink is ready");
+ return true;
+ }
+
+ if (!player->set_mode.video_export) {
+ LOGW("there is no callback for enabling");
+ return true;
+ }
+
+ videobin = player->pipeline->videobin;
+
+ LOGD("[update plugin][videosink] handoff %d", value->value.i_val);
+
+ g_object_set(videobin[MMPLAYER_V_SINK].gst,
+ "signal-handoffs", (value->value.i_val) ? TRUE : FALSE, NULL);
+
+ return true;
+}
+
+static bool __mmplayer_commit_gapless_mode(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+ mmplayer_gst_element_t *videobin = NULL;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && value, false);
+
+ if (!_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_NUM)) {
+ LOGD("will be applied when videosink is ready");
+ return true;
+ }
+
+ videobin = player->pipeline->videobin;
+
+ if (value->value.i_val > 0) {
+ LOGD("[update plugin][videosink] disable last sample for gapless");
+ g_object_set(videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
+ }
+
+ return true;
+}
+
+static bool __mmplayer_commit_audio_pitch_value(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+ mmplayer_pipeline_info_t *pipeline;
+ int pitch_control = 0;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && value, false);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline && player->pipeline->audiobin, true);
+
+ pipeline = player->pipeline;
+ mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_PITCH_CONTROL, &pitch_control);
+
+ if (!pitch_control || !pipeline->audiobin[MMPLAYER_A_PITCH].gst) {
+ LOGW("audio pitch is disabled");
+ return true;
+ }
+
+ LOGD("[update plugin][pitch] value to %1.3f", value->value.d_val);
+ g_object_set(pipeline->audiobin[MMPLAYER_A_PITCH].gst, "pitch", (value->value.d_val), NULL);
+
+ return true;
+}
+
+static int __mmplayer_get_array_count(MMHandleType handle, int type)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+
+ int count = 0;
+ int i = 0;
+
+ if (type == KEYWORD_A_OFFLOAD_MEDIA_FORMAT) {
+ while (player->ini.audio_offload_media_format[i++][0])
+ count++;
+ } else if (type == KEYWORD_MEDIA_STREAM_IN_FORMAT) {
+ while (player->ini.media_stream_input_format[i++][0])
+ count++;
+ }
+ return count;
+}
+
+static media_format_mimetype_e __mmplayer_get_supported_format_mimetype(MMHandleType handle, int type, int i)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+ media_format_mimetype_e format = MEDIA_FORMAT_MAX;
+ char *name = NULL;
+
+ if (type == KEYWORD_A_OFFLOAD_MEDIA_FORMAT) {
+ name = player->ini.audio_offload_media_format[i];
+ } else if (type == KEYWORD_MEDIA_STREAM_IN_FORMAT) {
+ name = player->ini.media_stream_input_format[i];
+ } else {
+ LOGE("invalid ini type");
+ goto EXIT;
+ }
+
+ if (!strcmp(name, "MP3"))
+ format = MEDIA_FORMAT_MP3;
+ else if (!strcmp(name, "AAC"))
+ format = MEDIA_FORMAT_AAC;
+ else if (!strcmp(name, "H264_SP"))
+ format = MEDIA_FORMAT_H264_SP;
+ else if (!strcmp(name, "H264_MP"))
+ format = MEDIA_FORMAT_H264_MP;
+ else if (!strcmp(name, "H264_HP"))
+ format = MEDIA_FORMAT_H264_HP;
+ else if (!strcmp(name, "PCM"))
+ format = MEDIA_FORMAT_PCM;
+ else if (!strcmp(name, "PCM_S16LE"))
+ format = MEDIA_FORMAT_PCM_S16LE;
+ else if (!strcmp(name, "PCM_S24LE"))
+ format = MEDIA_FORMAT_PCM_S24LE;
+ else if (!strcmp(name, "PCM_S32LE"))
+ format = MEDIA_FORMAT_PCM_S32LE;
+ else if (!strcmp(name, "PCM_S16BE"))
+ format = MEDIA_FORMAT_PCM_S16BE;
+ else if (!strcmp(name, "PCM_S24BE"))
+ format = MEDIA_FORMAT_PCM_S24BE;
+ else if (!strcmp(name, "PCM_S32BE"))
+ format = MEDIA_FORMAT_PCM_S32BE;
+ else if (!strcmp(name, "PCM_F32LE"))
+ format = MEDIA_FORMAT_PCM_F32LE;
+ else if (!strcmp(name, "PCM_F32BE"))
+ format = MEDIA_FORMAT_PCM_F32BE;
+ else if (!strcmp(name, "PCM_U16LE"))
+ format = MEDIA_FORMAT_PCM_U16LE;
+ else if (!strcmp(name, "PCM_U24LE"))
+ format = MEDIA_FORMAT_PCM_U24LE;
+ else if (!strcmp(name, "PCM_U32LE"))
+ format = MEDIA_FORMAT_PCM_U32LE;
+ else if (!strcmp(name, "PCM_U16BE"))
+ format = MEDIA_FORMAT_PCM_U16BE;
+ else if (!strcmp(name, "PCM_U24BE"))
+ format = MEDIA_FORMAT_PCM_U24BE;
+ else if (!strcmp(name, "PCM_U32BE"))
+ format = MEDIA_FORMAT_PCM_U32BE;
+ else
+ LOGE("FIXME: need to modify function to support more format");
+
+EXIT:
+ LOGD("[%d type] supported format 0x%X(%s)", type, format, name);
+
+ return format;
+}
+
+static int __mmplayer_get_available_format(MMHandleType handle, int type, int **format)
+{
+ int *arr = NULL;
+ int total_count = 0;
+ int count = 0;
+ int i = 0;
+ int fmt = 0;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, -1);
+
+ count = __mmplayer_get_array_count(handle, type);
+
+ if (count <= 0)
+ return -1;
+
+ arr = (int *) g_malloc0(count * sizeof(int));
+ for (i = 0 ; i < count ; i++) {
+ fmt = __mmplayer_get_supported_format_mimetype(handle, type, i);
+ if (fmt != MEDIA_FORMAT_MAX)
+ arr[total_count++] = fmt;
+ }
+
+ if (total_count <= 0) {
+ g_free(arr);
+ return -1;
+ }
+
+ LOGD("[%d type] num of supported codec %d", type, total_count);
+
+ *format = arr;
+ return total_count;
+}
+
+static int __mmplayer_set_ini_to_valid_info(MMHandleType handle)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+ int *format = NULL;
+ int total_count = 0;
+
+ /* supported format of audio offload */
+ total_count = __mmplayer_get_available_format(handle, KEYWORD_A_OFFLOAD_MEDIA_FORMAT, &format);
+ if (format && total_count > 0) {
+ player->default_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_1.int_array = format;
+ player->default_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_2.count = total_count;
+ }
+
+ /* supported format of media stream input */
+ total_count = __mmplayer_get_available_format(handle, KEYWORD_MEDIA_STREAM_IN_FORMAT, &format);
+ if (format && total_count > 0) {
+ player->default_attrs[MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT].validity_value_1.int_array = format;
+ player->default_attrs[MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT].validity_value_2.count = total_count;
+ }
+
+ /* default codec type */
+ if (!strcmp(player->ini.audiocodec_default_type, "sw"))
+ player->default_attrs[MMPLAYER_ATTRS_AUDIO_CODEC_TYPE].default_value.value_int = MM_PLAYER_CODEC_TYPE_SW;
+
+ if (!strcmp(player->ini.videocodec_default_type, "sw"))
+ player->default_attrs[MMPLAYER_ATTRS_VIDEO_CODEC_TYPE].default_value.value_int = MM_PLAYER_CODEC_TYPE_SW;
+
+ return MM_ERROR_NONE;
+}
+
+static int __mmplayer_release_ini_info(MMHandleType handle)
+{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
+ int *mem = NULL;
+
+ MMPLAYER_FENTER();
+
+ mem = (int *)(player->default_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_1.int_array);
+ g_free(mem);
+ player->default_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_1.int_array = NULL;
+ player->default_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_2.count = 0;
+
+ mem = (int *)(player->default_attrs[MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT].validity_value_1.int_array);
+ g_free(mem);
+ player->default_attrs[MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT].validity_value_1.int_array = NULL;
+ player->default_attrs[MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT].validity_value_2.count = 0;
+
+ MMPLAYER_FLEAVE();
+ return MM_ERROR_NONE;
+}
+
+static void __mmplayer_print_attrs(const char *attr_name, const MMAttrsValue * value, const char *prefix)
+{
+ switch (value->type) {
+ case MM_ATTRS_TYPE_INT:
+ LOGD("[ %s : %s : %d ]", prefix, attr_name, value->value.i_val);
+ break;
+ case MM_ATTRS_TYPE_DOUBLE:
+ LOGD("[ %s : %s : %f ]", prefix, attr_name, value->value.d_val);
+ break;
+ case MM_ATTRS_TYPE_STRING:
+ LOGD("[ %s : %s : %s ]", prefix, attr_name, value->value.s_val);
+ break;
+ case MM_ATTRS_TYPE_DATA:
+ LOGD("[ %s : %s : %p ]", prefix, attr_name, value->value.p_val);
+ break;
+ default:
+ break;
+ }
+
+ return;
+}
+
+bool _mmplayer_commit_attribute(int attr_idx, const char *attr_name, const MMAttrsValue *value, void *commit_param)
+{
+ bool ret = false;
+ mmplayer_t *player = MM_PLAYER_CAST(commit_param);
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player && (attr_idx >= 0) && attr_name && value, false);
+
+ if (player->default_attrs[attr_idx].attr_commit) {
+ __mmplayer_print_attrs(attr_name, value, "Dynamic");
+ ret = player->default_attrs[attr_idx].attr_commit((MMHandleType)commit_param, attr_idx, value);
+ } else {
+ __mmplayer_print_attrs(attr_name, value, "Static");
+ ret = true;
+ }
+
+ return ret;
+}
+
+int _mmplayer_get_attribute(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list args_list)
{
int result = MM_ERROR_NONE;
- MMHandleType attrs = 0;
+ MMHandleType attrs = NULL;
/* NOTE : Don't need to check err_attr_name because it can be set NULL */
/* if it's not want to know it. */
return result;
}
-int
-_mmplayer_set_attribute(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list args_list)
+int __mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
+{
+ mmplayer_t *player = NULL;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ player = MM_PLAYER_CAST(handle);
+
+ if (!g_strrstr(attribute_name, "display") || !g_strcmp0(attribute_name, "exported_shell_handle"))
+ return MM_ERROR_NONE;
+
+ if (!_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_NUM)) {
+ LOGD("will be applied when videosink is ready");
+ return MM_ERROR_NONE;
+ }
+
+ if (_mmplayer_update_video_overlay_param(player, attribute_name) != MM_ERROR_NONE) {
+ LOGW("not supported video param %s", attribute_name);
+ return MM_ERROR_NONE;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+int _mmplayer_set_attribute(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list args_list)
{
int result = MM_ERROR_NONE;
- MMHandleType attrs = 0;
+ MMHandleType attrs = NULL;
/* NOTE : Don't need to check err_attr_name because it can be set NULL */
/* if it's not want to know it. */
/* set attributes and commit them */
result = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, args_list);
-
if (result != MM_ERROR_NONE) {
LOGE("failed to set %s attribute", attribute_name);
return result;
}
+ /* Note: 'attr_commit' function is called before committing the new value to attr struct.
+ so if there is a value to apply after committing, it should be added below function. */
result = __mmplayer_apply_attribute(handle, attribute_name);
if (result != MM_ERROR_NONE) {
LOGE("failed to apply attributes");
return result;
}
- return result;
+ return MM_ERROR_NONE;
}
-int
-_mmplayer_get_attributes_info(MMHandleType handle, const char *attribute_name, MMPlayerAttrsInfo *dst_info)
+int _mmplayer_get_attributes_info(MMHandleType handle, const char *attribute_name, mmplayer_attrs_info_t *dst_info)
{
int result = MM_ERROR_NONE;
- MMHandleType attrs = 0;
+ MMHandleType attrs = NULL;
MMAttrsInfo src_info = {0, };
MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
return result;
}
- memset(dst_info, 0x00, sizeof(MMPlayerAttrsInfo));
+ memset(dst_info, 0x00, sizeof(mmplayer_attrs_info_t));
dst_info->type = src_info.type;
dst_info->flag = src_info.flag;
return result;
}
-int
-__mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
-{
- mm_player_t *player = 0;
-
- MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
- MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
-
- player = MM_PLAYER_CAST(handle);
- MMPlayerGstPipelineInfo *pipeline = player->pipeline;
-
- /* Currently, there are only display related implementation at below */
- if (!pipeline ||
- !pipeline->videobin ||
- !pipeline->videobin[MMPLAYER_V_SINK].gst) {
- /*
- * The attribute should be committed even though videobin is not created yet.
- * So, true should be returned here.
- * Otherwise, video can be diaplayed abnormal.
- */
- return MM_ERROR_NONE;
- }
-
- if (g_strrstr(attribute_name, "display")) {
- char *param_name = NULL;
- int str_len = strlen(attribute_name);
- param_name = g_malloc0(str_len + 1);
- if (!param_name) {
- LOGE("failed to alloc param_name");
- return MM_ERROR_PLAYER_INTERNAL;
- }
- strncpy(param_name, attribute_name, str_len);
- param_name[str_len] = '\0';
- LOGD(" param_name: %s", param_name);
- if (MM_ERROR_NONE != _mmplayer_update_video_param(player, param_name)) {
- MMPLAYER_FREEIF(param_name);
- LOGE("failed to update video param");
- return MM_ERROR_PLAYER_INTERNAL;
- }
- MMPLAYER_FREEIF(param_name);
- }
-
- if (g_strrstr(attribute_name, MM_PLAYER_GAPLESS_MODE)) {
- int gapless = 0;
-
- mm_attrs_get_int_by_name(player->attrs, "gapless_mode", &gapless);
- if (gapless > 0) {
- LOGD("disable last-sample at videosink");
- g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
- }
- }
-
- if (g_strrstr(attribute_name, MM_PLAYER_ENABLE_VIDEO_DECODED_CB)) {
- if (!player->set_mode.media_packet_video_stream) {
- LOGE("there is no callback for media_packet");
- return MM_ERROR_PLAYER_INTERNAL;
- }
- int enable = 0;
- mm_attrs_get_int_by_name(player->attrs, "enable_video_decoded_cb", &enable);
- g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "signal-handoffs", enable ? TRUE : FALSE, NULL);
- }
-
- return MM_ERROR_NONE;
-}
-
-MMHandleType
-_mmplayer_construct_attribute(MMHandleType handle)
+MMHandleType _mmplayer_construct_attribute(MMHandleType handle)
{
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
int result = MM_ERROR_NONE;
int idx = 0;
- MMHandleType attrs = 0;
+ MMHandleType attrs = NULL;
int num_of_attrs = 0;
MMAttrsConstructInfo *base = NULL;
- MMPLAYER_RETURN_VAL_IF_FAIL(handle, 0);
-
- MMPlayerAttrsSpec player_attrs[] = {
+ mmplayer_attrs_spec_t player_attrs[] = {
{
- "profile_uri", // name
- MM_ATTRS_TYPE_STRING, // type
- MM_ATTRS_FLAG_RW, // flag
- (void *)NULL, // default value
- MM_ATTRS_VALID_TYPE_NONE, // validity type
- 0, // validity min value
- 0 // validity max value
+ MMPLAYER_ATTRS_PROFILE_URI, /* ID */
+ (char *)"profile_uri", /* Name */
+ MM_ATTRS_TYPE_STRING, /* Value Type */
+ MM_ATTRS_FLAG_RW, /* Flag */
+ {(void *)NULL}, /* default value */
+ MM_ATTRS_VALID_TYPE_NONE, /* validity type */
+ {0}, /* validity min value */
+ {0}, /* validity max value */
+ NULL, /* Runtime setting function of the attribute */
},
{
- "profile_user_param",
+ MMPLAYER_ATTRS_PROFILE_USER_PARAM,
+ (char *)"profile_user_param",
MM_ATTRS_TYPE_DATA,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "profile_play_count",
+ MMPLAYER_ATTRS_PROFILE_PLAY_COUNT,
+ (char *)"profile_play_count",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)1, /* -1 : repeat continually */
+ {(void *)1}, /* -1 : repeat continually */
MM_ATTRS_VALID_TYPE_INT_RANGE,
- -1,
- 1
+ {.int_min = -1},
+ {.int_max = 1},
+ NULL,
},
{
- "profile_prepare_async",
+ MMPLAYER_ATTRS_PROFILE_PREPARE_ASYNC,
+ (char *)"profile_prepare_async",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
+ {.int_min = 0},
+ {.int_max = 1},
+ NULL,
},
{
- "streaming_user_agent",
+ MMPLAYER_ATTRS_STREAMING_USER_AGENT,
+ (char *)"streaming_user_agent",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "streaming_cookie",
+ MMPLAYER_ATTRS_STREAMING_COOKIE,
+ (char *)"streaming_cookie",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "subtitle_uri",
+ MMPLAYER_ATTRS_SUBTITLE_URI,
+ (char *)"subtitle_uri",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "content_bitrate",
+ MMPLAYER_ATTRS_CONTENT_BITRATE,
+ (char *)"content_bitrate",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_max_bitrate",
+ MMPLAYER_ATTRS_CONTENT_MAX_BITRATE,
+ (char *)"content_max_bitrate",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_video_found",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_FOUND,
+ (char *)"content_video_found",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
+ {.int_min = 0},
+ {.int_max = 1},
+ NULL,
},
{
- "content_video_codec",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_CODEC,
+ (char *)"content_video_codec",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "content_video_bitrate",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_BITRATE,
+ (char *)"content_video_bitrate",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_video_fps",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_FPS,
+ (char *)"content_video_fps",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_video_width",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_WIDTH,
+ (char *)"content_video_width",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_video_height",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_HEIGHT,
+ (char *)"content_video_height",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_audio_codec",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_ORIENTATION,
+ (char *)"content_video_orientation", /* orientation of video content */
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "content_audio_bitrate",
+ MMPLAYER_ATTRS_CONTENT_VIDEO_IS_SPHERICAL,
+ (char *)"content_video_is_spherical",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)-1},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = -1},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_audio_channels",
+ MMPLAYER_ATTRS_CONTENT_AUDIO_CODEC,
+ (char *)"content_audio_codec",
+ MM_ATTRS_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_CONTENT_AUDIO_BITRATE,
+ (char *)"content_audio_bitrate",
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_CONTENT_AUDIO_CHANNELS,
+ (char *)"content_audio_channels",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_audio_samplerate",
+ MMPLAYER_ATTRS_CONTENT_AUDIO_SAMPLERATE,
+ (char *)"content_audio_samplerate",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_text_track_num",
+ MMPLAYER_ATTRS_CONTENT_AUDIO_FORMAT,
+ (char *)"content_audio_format",
+ MM_ATTRS_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_CONTENT_TEXT_TRACK_NUM,
+ (char *)"content_text_track_num",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "current_text_track_index",
+ MMPLAYER_ATTRS_CONTENT_TEXT_TRACK_INDEX,
+ (char *)"current_text_track_index",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)-1,
+ {(void *)-1},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- -1,
- MMPLAYER_MAX_INT
+ {.int_min = -1},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "tag_artist",
+ MMPLAYER_ATTRS_TAG_ARTIST,
+ (char *)"tag_artist",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_title",
+ MMPLAYER_ATTRS_TAG_TITLE,
+ (char *)"tag_title",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_album",
+ MMPLAYER_ATTRS_TAG_ALBUM,
+ (char *)"tag_album",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
},
{
- "tag_genre",
+ MMPLAYER_ATTRS_TAG_GENRE,
+ (char *)"tag_genre",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_author",
+ MMPLAYER_ATTRS_TAG_AUTHOR,
+ (char *)"tag_author",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_copyright",
+ MMPLAYER_ATTRS_TAG_COPYRIGHT,
+ (char *)"tag_copyright",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_date",
+ MMPLAYER_ATTRS_TAG_DATE,
+ (char *)"tag_date",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_description",
+ MMPLAYER_ATTRS_TAG_DESCRIPTION,
+ (char *)"tag_description",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "tag_track_num",
+ MMPLAYER_ATTRS_TAG_TRACK_NUM,
+ (char *)"tag_track_num",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "tag_album_cover",
+ MMPLAYER_ATTRS_TAG_ALBUM_COVER,
+ (char *)"tag_album_cover",
MM_ATTRS_TYPE_DATA,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "display_rotation",
+ MMPLAYER_ATTRS_DISPLAY_ROTATION,
+ (char *)"display_rotation",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)MM_DISPLAY_ROTATION_NONE,
+ {(void *)MM_DISPLAY_ROTATION_NONE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_ROTATION_NONE,
- MM_DISPLAY_ROTATION_270
+ {.int_min = MM_DISPLAY_ROTATION_NONE},
+ {.int_max = MM_DISPLAY_ROTATION_270},
+ NULL,
},
{
- "display_visible",
+ MMPLAYER_ATTRS_DISPLAY_VISIBLE,
+ (char *)"display_visible",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)FALSE,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
{
- "display_method",
+ MMPLAYER_ATTRS_DISPLAY_METHOD,
+ (char *)"display_method",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)MM_DISPLAY_METHOD_LETTER_BOX,
+ {(void *)MM_DISPLAY_METHOD_LETTER_BOX},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_METHOD_LETTER_BOX,
- MM_DISPLAY_METHOD_CUSTOM_ROI
+ {.int_min = MM_DISPLAY_METHOD_LETTER_BOX},
+ {.int_max = MM_DISPLAY_METHOD_CUSTOM_ROI},
+ NULL,
},
{
- "display_overlay",
- MM_ATTRS_TYPE_DATA,
+ MMPLAYER_ATTRS_DISPLAY_OVERLAY,
+ (char *)"display_overlay",
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {(void *)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_win_roi_x",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_X,
+ (char *)"display_win_roi_x",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MMPLAYER_MIN_INT,
- MMPLAYER_MAX_INT
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_win_roi_y",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_Y,
+ (char *)"display_win_roi_y",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MMPLAYER_MIN_INT,
- MMPLAYER_MAX_INT
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_win_roi_width",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_WIDTH,
+ (char *)"display_win_roi_width",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_win_roi_height",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_HEIGHT,
+ (char *)"display_win_roi_height",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_surface_type",
+ MMPLAYER_ATTRS_DISPLAY_SURFACE_TYPE,
+ (char *)"display_surface_type",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)MM_DISPLAY_SURFACE_NULL,
+ {(void *)MM_DISPLAY_SURFACE_NULL},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_SURFACE_OVERLAY,
- MM_DISPLAY_SURFACE_NUM - 1
+ {.int_min = MM_DISPLAY_SURFACE_OVERLAY},
+ {.int_max = MM_DISPLAY_SURFACE_NUM - 1},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_DISPLAY_EXPORTED_SHELL_HANDLE,
+ (char *)"exported_shell_handle",
+ MM_ATTRS_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
},
{
- "sound_stream_type",
+ MMPLAYER_ATTRS_SOUND_STREAM_TYPE,
+ (char *)"sound_stream_type",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "sound_stream_index",
+ MMPLAYER_ATTRS_SOUND_STREAM_INDEX,
+ (char *)"sound_stream_index",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- 0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- -1,
- MMPLAYER_MAX_INT
+ {.int_min = -1},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "sound_latency_mode",
+ MMPLAYER_ATTRS_SOUND_LATENCY_MODE,
+ (char *)"sound_latency_mode",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)1, // 0: low latency, 1: middle latency 2: high latency
+ {(void *)1}, /* 0: low latency, 1: middle latency 2: high latency */
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 2
+ {.int_min = 0},
+ {.int_max = 2},
+ NULL,
},
{
- "pcm_extraction_samplerate", // set samplerate for pcm extraction
+ MMPLAYER_ATTRS_PCM_EXTRACTION_SAMPLERATE,
+ (char *)"pcm_extraction_samplerate", /* set samplerate for pcm extraction */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)44100, // hz
+ {(void *)44100},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "pcm_extraction_channels", // set channels for pcm extraction
+ MMPLAYER_ATTRS_PCM_EXTRACTION_CHANNELS,
+ (char *)"pcm_extraction_channels", /* set channels for pcm extraction */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)1,
+ {(void *)1},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "accurate_seek",
+ MMPLAYER_ATTRS_ACCURATE_SEEK,
+ (char *)"accurate_seek",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)0,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
+ {.int_min = 0},
+ {.int_max = 1},
+ NULL,
},
{
- "content_video_orientation", // orientation of video content
+ MMPLAYER_ATTRS_PCM_EXTRACTION_FORMAT,
+ (char *)"pcm_extraction_format",
MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
+ {(void *)NULL},
MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {0},
+ {0},
+ NULL,
},
{
- "pcm_audioformat",
- MM_ATTRS_TYPE_STRING,
+ MMPLAYER_ATTRS_DRC_MODE,
+ (char *)"drc_mode",
+ MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {(void *)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
{
- "drc_mode",
+ MMPLAYER_ATTRS_GAPLESS_MODE,
+ (char *)"gapless_mode",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)FALSE,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ __mmplayer_commit_gapless_mode,
},
{
- "gapless_mode",
+ MMPLAYER_ATTRS_ENABLE_VIDEO_DECODED_CB,
+ (char *)"enable_video_decoded_cb",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)FALSE,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ __mmplayer_commit_enable_video_decoded_cb,
},
{
- "enable_video_decoded_cb",
+ MMPLAYER_ATTRS_VIDEO_CODEC_TYPE,
+ (char *)"video_codec_type",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)FALSE,
+ {(void *)MM_PLAYER_CODEC_TYPE_HW},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {.int_min = MM_PLAYER_CODEC_TYPE_HW},
+ {.int_max = MM_PLAYER_CODEC_TYPE_SW},
+ NULL,
},
{
- "content_video_is_spherical",
+ MMPLAYER_ATTRS_AUDIO_CODEC_TYPE,
+ (char *)"audio_codec_type",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)-1,
+ {(void *)MM_PLAYER_CODEC_TYPE_HW},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- -1,
- MMPLAYER_MAX_INT
+ {.int_min = MM_PLAYER_CODEC_TYPE_HW},
+ {.int_max = MM_PLAYER_CODEC_TYPE_SW},
+ NULL,
},
{
- "video_codec_type",
+ MMPLAYER_ATTRS_VIDEO_BUFFER_TOTAL_SIZE,
+ (char *)"video_buffer_total_size",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)MM_PLAYER_CODEC_TYPE_DEFAULT,
+ {(void *)DEFAULT_NUM_OF_V_OUT_BUFFER},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_PLAYER_CODEC_TYPE_DEFAULT,
- MM_PLAYER_CODEC_TYPE_SW
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "audio_codec_type",
+ MMPLAYER_ATTRS_VIDEO_BUFFER_EXTRA_SIZE,
+ (char *)"video_buffer_extra_size",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *)MM_PLAYER_CODEC_TYPE_DEFAULT,
+ {(void *)DEFAULT_NUM_OF_V_OUT_BUFFER},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_PLAYER_CODEC_TYPE_DEFAULT,
- MM_PLAYER_CODEC_TYPE_SW
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_PREBUFFER_MS,
+ (char *)"prebuffer_ms", /* user setting */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *) MIN_BUFFERING_TIME},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = MIN_BUFFERING_TIME},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_REBUFFER_MS,
+ (char *)"rebuffer_ms", /* user setting */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *) MIN_BUFFERING_TIME},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = MIN_BUFFERING_TIME},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_PITCH_CONTROL,
+ (char *)"pitch_control", /* MM_PLAYER_PITCH_CONTROL */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_PITCH_VALUE,
+ (char *)"pitch_value", /* MM_PLAYER_PITCH_VALUE */
+ MM_ATTRS_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {.value_double = 1.0},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {.double_min = 0.5},
+ {.double_max = 2},
+ __mmplayer_commit_audio_pitch_value,
+ },
+ {
+ MMPLAYER_ATTRS_AUDIO_OFFLOAD,
+ (char *)"audio_offload", /* MM_PLAYER_AUDIO_OFFLOAD */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT,
+ (char *)"audio_offload_format", /* MM_PLAYER_AUDIO_OFFLOAD_FORMAT, array of media_format_mimetype_e */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {.int_array = NULL},
+ {.count = 0},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT, /* MM_PLAYER_MEDIA_STREAM_INPUT_FORMAT */
+ (char *)"media_stream_input_format",
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {.int_array = NULL},
+ {.count = 0},
+ NULL,
+ },
+ {
+ MMPLAYER_ATTRS_AUDIO_ONLY,
+ (char *)"audio_only", /* MM_PLAYER_AUDIO_ONLY */
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void *)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
};
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, 0);
+
num_of_attrs = ARRAY_SIZE(player_attrs);
base = g_try_new(MMAttrsConstructInfo, num_of_attrs);
if (!base) {
LOGE("failed to alloc attrs constructor");
- return 0;
+ return NULL;
+ }
+
+ /* alloc default attribute info */
+ player->default_attrs = (mmplayer_attrs_spec_t *)g_try_malloc(sizeof(mmplayer_attrs_spec_t) * num_of_attrs);
+ if (player->default_attrs == NULL) {
+ LOGE("failed to alloc default attribute info");
+ goto ERROR;
}
+ memcpy(player->default_attrs, player_attrs, sizeof(mmplayer_attrs_spec_t) * num_of_attrs);
+ __mmplayer_set_ini_to_valid_info(handle);
+
/* initialize values of attributes */
for (idx = 0; idx < num_of_attrs; idx++) {
- base[idx].name = player_attrs[idx].name;
- base[idx].value_type = player_attrs[idx].value_type;
- base[idx].flags = player_attrs[idx].flags;
- base[idx].default_value = player_attrs[idx].default_value;
+ base[idx].name = player->default_attrs[idx].name;
+ base[idx].value_type = player->default_attrs[idx].value_type;
+ base[idx].flags = player->default_attrs[idx].flags;
+ base[idx].default_value = player->default_attrs[idx].default_value.value_void; /* FIXME: need to consider the double data type */
}
result = mm_attrs_new(base, num_of_attrs, "mmplayer_attrs",
- NULL, NULL, &attrs);
+ _mmplayer_commit_attribute, (void *)handle, &attrs);
/* clean */
MMPLAYER_FREEIF(base);
- if (result) {
+ if (result != MM_ERROR_NONE) {
LOGE("failed to create player attrs");
- return 0;
+ goto ERROR;
}
/* set validity type and range */
for (idx = 0; idx < num_of_attrs; idx++) {
- switch (player_attrs[idx].valid_type) {
+ mm_attrs_set_valid_type(attrs, idx, player->default_attrs[idx].valid_type);
+ switch (player->default_attrs[idx].valid_type) {
case MM_ATTRS_VALID_TYPE_INT_RANGE:
- {
- mm_attrs_set_valid_type(attrs, idx, MM_ATTRS_VALID_TYPE_INT_RANGE);
mm_attrs_set_valid_range(attrs, idx,
- player_attrs[idx].value_min,
- player_attrs[idx].value_max,
- (int)(intptr_t)(player_attrs[idx].default_value));
- }
+ player->default_attrs[idx].validity_value_1.int_min,
+ player->default_attrs[idx].validity_value_2.int_max,
+ player->default_attrs[idx].default_value.value_int);
break;
-
case MM_ATTRS_VALID_TYPE_INT_ARRAY:
- case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
+ if (player->default_attrs[idx].validity_value_1.int_array &&
+ player->default_attrs[idx].validity_value_2.count > 0)
+ mm_attrs_set_valid_array(attrs, idx,
+ (const int *)(player->default_attrs[idx].validity_value_1.int_array),
+ player->default_attrs[idx].validity_value_2.count,
+ player->default_attrs[idx].default_value.value_int);
+ break;
case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
+ mm_attrs_set_valid_double_range(attrs, idx,
+ player->default_attrs[idx].validity_value_1.double_min,
+ player->default_attrs[idx].validity_value_2.double_max,
+ player->default_attrs[idx].default_value.value_double);
+ break;
+ case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
+ LOGW("FIXME: need to set range value if required.");
+ case MM_ATTRS_VALID_TYPE_NONE:
+ case MM_ATTRS_VALID_TYPE_INVALID:
default:
break;
}
/* commit */
if (mm_attrs_commit_all(attrs)) {
LOGE("failed to update attributes");
- mm_attrs_free(attrs);
- return 0;
+ goto ERROR;
}
+ __mmplayer_release_ini_info(handle);
+
return attrs;
+
+ERROR:
+ MMPLAYER_FREEIF(base);
+ MMPLAYER_FREEIF(player->default_attrs);
+
+ if (attrs)
+ mm_attrs_free(attrs);
+
+ return NULL;
}
-bool
-_mmplayer_deconstruct_attribute(MMHandleType handle) // @
+bool _mmplayer_deconstruct_attribute(MMHandleType handle)
{
- mm_player_t *player = MM_PLAYER_CAST(handle);
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
- MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, false);
if (player->attrs) {
mm_attrs_free(player->attrs);
- player->attrs = 0;
+ player->attrs = NULL;
}
- return TRUE;
+ MMPLAYER_FREEIF(player->default_attrs);
+
+ return true;
}