*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
+ * YoungHwan An <younghwan_.an@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*===========================================================================================
| |
| INCLUDE FILES |
-| |
+| |
========================================================================================== */
-#include <vconf.h>
-#include <mm_attrs_private.h>
+#include <dlog.h>
#include <mm_attrs.h>
-
-#include <gst/video/videooverlay.h>
+#include "mm_player_utils.h"
#include "mm_player_priv.h"
#include "mm_player_attrs.h"
/*===========================================================================================
| |
| LOCAL DEFINITIONS AND DECLARATIONS FOR MODULE |
-| |
+| |
========================================================================================== */
-typedef struct{
- char *name;
- int value_type;
- int flags; // r, w
- void *default_value;
- int valid_type; // validity type
- int value_min; //<- set validity value range
- int value_max; //->
-}MMPlayerAttrsSpec;
-
-/*---------------------------------------------------------------------------
-| 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);
/*===========================================================================================
| |
| FUNCTION DEFINITIONS |
-| |
+| |
========================================================================================== */
-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)
{
- int result = MM_ERROR_NONE;
- MMHandleType attrs = 0;
+ 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);
- debug_fenter();
+ 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 = 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_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
- return_val_if_fail(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
attrs = MM_PLAYER_GET_ATTRS(handle);
result = mm_attrs_get_valist(attrs, err_attr_name, attribute_name, args_list);
- if ( result != MM_ERROR_NONE)
- debug_error("failed to get %s attribute\n", attribute_name);
-
- debug_fleave();
+ if (result != MM_ERROR_NONE)
+ LOGE("failed to get %s attribute", attribute_name);
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)
{
- int result = MM_ERROR_NONE;
- MMHandleType attrs = 0;
+ 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;
+}
- debug_fenter();
+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 = 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_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
- return_val_if_fail(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
attrs = MM_PLAYER_GET_ATTRS(handle);
/* set attributes and commit them */
result = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, args_list);
-
- if (result != MM_ERROR_NONE)
- {
- debug_error("failed to set %s attribute\n", attribute_name);
+ 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)
- {
- debug_error("failed to apply attributes\n");
+ if (result != MM_ERROR_NONE) {
+ LOGE("failed to apply attributes");
return result;
}
- debug_fleave();
-
- 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, };
- debug_fenter();
-
- return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
- return_val_if_fail(dst_info, MM_ERROR_COMMON_INVALID_ARGUMENT);
- return_val_if_fail(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(dst_info, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
attrs = MM_PLAYER_GET_ATTRS(handle);
result = mm_attrs_get_info_by_name(attrs, attribute_name, &src_info);
- if ( result != MM_ERROR_NONE)
- {
- debug_error("failed to get attribute info\n");
+ if (result != MM_ERROR_NONE) {
+ LOGE("failed to get attribute info");
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;
- dst_info->validity_type= src_info.validity_type;
+ dst_info->validity_type = src_info.validity_type;
- switch(src_info.validity_type)
- {
- case MM_ATTRS_VALID_TYPE_INT_ARRAY:
- dst_info->int_array.array = src_info.int_array.array;
- dst_info->int_array.count = src_info.int_array.count;
- dst_info->int_array.d_val = src_info.int_array.dval;
+ switch (src_info.validity_type) {
+ case MM_ATTRS_VALID_TYPE_INT_ARRAY:
+ dst_info->int_array.array = src_info.int_array.array;
+ dst_info->int_array.count = src_info.int_array.count;
+ dst_info->int_array.d_val = src_info.int_array.dval;
break;
- case MM_ATTRS_VALID_TYPE_INT_RANGE:
- dst_info->int_range.min = src_info.int_range.min;
- dst_info->int_range.max = src_info.int_range.max;
- dst_info->int_range.d_val = src_info.int_range.dval;
+ case MM_ATTRS_VALID_TYPE_INT_RANGE:
+ dst_info->int_range.min = src_info.int_range.min;
+ dst_info->int_range.max = src_info.int_range.max;
+ dst_info->int_range.d_val = src_info.int_range.dval;
break;
- case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
- dst_info->double_array.array = src_info.double_array.array;
- dst_info->double_array.count = src_info.double_array.count;
- dst_info->double_array.d_val = src_info.double_array.dval;
+ case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
+ dst_info->double_array.array = src_info.double_array.array;
+ dst_info->double_array.count = src_info.double_array.count;
+ dst_info->double_array.d_val = src_info.double_array.dval;
break;
- case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
- dst_info->double_range.min = src_info.double_range.min;
- dst_info->double_range.max = src_info.double_range.max;
- dst_info->double_range.d_val = src_info.double_range.dval;
+ case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
+ dst_info->double_range.min = src_info.double_range.min;
+ dst_info->double_range.max = src_info.double_range.max;
+ dst_info->double_range.d_val = src_info.double_range.dval;
break;
- default:
+ default:
break;
}
- debug_fleave();
-
return result;
}
-int
-__mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
-{
- MMHandleType attrs = 0;
- mm_player_t* player = 0;
-
- debug_fenter();
-
- return_val_if_fail(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
- return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
-
- attrs = MM_PLAYER_GET_ATTRS(handle);
- player = MM_PLAYER_CAST(handle);
-
- if ( g_strrstr(attribute_name, "display") )
- {
- /* check videosink element is created */
- if ( !player->pipeline ||
- !player->pipeline->videobin ||
- !player->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 ( MM_ERROR_NONE != _mmplayer_update_video_param( player ) )
- {
- debug_error("failed to update video param");
- return MM_ERROR_PLAYER_INTERNAL;
- }
- }
-
- debug_fleave();
-
- 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;
- mmf_attrs_construct_info_t *base = NULL;
- gchar *system_ua = NULL;
- gchar *system_proxy = NULL;
-
- debug_fenter();
-
- return_val_if_fail (handle, 0);
+ MMAttrsConstructInfo *base = NULL;
- 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
- },
- {
- "profile_play_count",
- MM_ATTRS_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- (void *) 1, // -1 : repeat continually
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- -1,
- MMPLAYER_MAX_INT
- },
- {
- "profile_prepare_async",
- MM_ATTRS_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
- },
- { /* update registry for downloadable codec */
- "profile_update_registry",
- MM_ATTRS_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
- },
- {
- "streaming_type",
- MM_ATTRS_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- (void *) STREAMING_SERVICE_NONE,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- STREAMING_SERVICE_VOD,
- STREAMING_SERVICE_NUM
+ {0},
+ {0},
+ NULL,
},
{
- "streaming_udp_timeout",
+ MMPLAYER_ATTRS_PROFILE_PLAY_COUNT,
+ (char *)"profile_play_count",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 10000,
+ {(void *)1}, /* -1 : repeat continually */
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
- },
- {
- "streaming_user_agent",
- MM_ATTRS_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- (void *) NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {.int_min = -1},
+ {.int_max = 1},
+ NULL,
},
{
- "streaming_wap_profile",
- MM_ATTRS_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- (void *) NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
- },
- {
- "streaming_network_bandwidth",
+ MMPLAYER_ATTRS_PROFILE_PREPARE_ASYNC,
+ (char *)"profile_prepare_async",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 128000,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = 1},
+ NULL,
},
{
- "streaming_cookie",
+ 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_proxy",
+ 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
- },
- {
- "content_duration",
- MM_ATTRS_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {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_video_track_num",
- MM_ATTRS_TYPE_INT,
+ MMPLAYER_ATTRS_CONTENT_VIDEO_ORIENTATION,
+ (char *)"content_video_orientation", /* orientation of video content */
+ MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
},
{
- "content_audio_found",
+ 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,
- 1
+ {.int_min = -1},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "content_audio_codec",
+ MMPLAYER_ATTRS_CONTENT_AUDIO_CODEC,
+ (char *)"content_audio_codec",
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_AUDIO_BITRATE,
+ (char *)"content_audio_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_audio_channels",
+ 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,
+ },
+ {
+ 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,
},
{
- "content_audio_track_num",
+ 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,
},
{
- "content_audio_format",
+ MMPLAYER_ATTRS_CONTENT_TEXT_TRACK_INDEX,
+ (char *)"current_text_track_index",
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,
},
{
- "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_roi_x",
+ MMPLAYER_ATTRS_DISPLAY_ROTATION,
+ (char *)"display_rotation",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 0,
+ {(void *)MM_DISPLAY_ROTATION_NONE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MM_DISPLAY_ROTATION_NONE},
+ {.int_max = MM_DISPLAY_ROTATION_270},
+ NULL,
},
{
- "display_roi_y",
+ MMPLAYER_ATTRS_DISPLAY_VISIBLE,
+ (char *)"display_visible",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 0,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
{
- "display_roi_width",
+ MMPLAYER_ATTRS_DISPLAY_METHOD,
+ (char *)"display_method",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 480,
+ {(void *)MM_DISPLAY_METHOD_LETTER_BOX},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MM_DISPLAY_METHOD_LETTER_BOX},
+ {.int_max = MM_DISPLAY_METHOD_CUSTOM_ROI},
+ NULL,
},
{
- "display_roi_height",
+ MMPLAYER_ATTRS_DISPLAY_OVERLAY,
+ (char *)"display_overlay",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 800,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_rotation",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_X,
+ (char *)"display_win_roi_x",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) MM_DISPLAY_ROTATION_NONE,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_ROTATION_NONE,
- MM_DISPLAY_ROTATION_270
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_visible",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_Y,
+ (char *)"display_win_roi_y",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) TRUE,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_method",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_WIDTH,
+ (char *)"display_win_roi_width",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) MM_DISPLAY_METHOD_LETTER_BOX,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_METHOD_LETTER_BOX,
- MM_DISPLAY_METHOD_CUSTOM_ROI
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_overlay",
- MM_ATTRS_TYPE_DATA,
- MM_ATTRS_FLAG_RW,
- (void *) NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
- },
- {
- "display_overlay_user_data",
- MM_ATTRS_TYPE_DATA,
- MM_ATTRS_FLAG_RW,
- (void *) NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
- },
- {
- "display_zoom",
- MM_ATTRS_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- (void *) 1,
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- 1.0,
- 9.0
- },
- {
- "display_surface_type",
+ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_HEIGHT,
+ (char *)"display_win_roi_height",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) MM_DISPLAY_SURFACE_NULL,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_SURFACE_X,
- MM_DISPLAY_SURFACE_X_EXT
- },
- {
- "display_evas_surface_sink",
- MM_ATTRS_TYPE_STRING,
- MM_ATTRS_FLAG_READABLE,
- (void *) PLAYER_INI()->videosink_element_evas,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "display_force_aspect_ration",
+ MMPLAYER_ATTRS_DISPLAY_SURFACE_TYPE,
+ (char *)"display_surface_type",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 1,
+ {(void *)MM_DISPLAY_SURFACE_NULL},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MM_DISPLAY_SURFACE_OVERLAY},
+ {.int_max = MM_DISPLAY_SURFACE_NUM - 1},
+ NULL,
},
{
- "display_width", // dest width of fimcconvert ouput
- MM_ATTRS_TYPE_INT,
+ MMPLAYER_ATTRS_DISPLAY_EXPORTED_SHELL_HANDLE,
+ (char *)"exported_shell_handle",
+ MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
},
{
- "display_height", // dest height of fimcconvert ouput
- MM_ATTRS_TYPE_INT,
+ MMPLAYER_ATTRS_SOUND_STREAM_TYPE,
+ (char *)"sound_stream_type",
+ MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
},
{
- "display_evas_do_scaling",
+ MMPLAYER_ATTRS_SOUND_STREAM_INDEX,
+ (char *)"sound_stream_index",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) TRUE,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {.int_min = -1},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "sound_fadeup",
+ MMPLAYER_ATTRS_SOUND_LATENCY_MODE,
+ (char *)"sound_latency_mode",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) FALSE,
+ {(void *)1}, /* 0: low latency, 1: middle latency 2: high latency */
MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {.int_min = 0},
+ {.int_max = 2},
+ NULL,
},
{
- "sound_fadedown",
+ MMPLAYER_ATTRS_PCM_EXTRACTION_SAMPLERATE,
+ (char *)"pcm_extraction_samplerate", /* set samplerate for pcm extraction */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) FALSE,
+ {(void *)44100},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "sound_volume_type",
+ MMPLAYER_ATTRS_PCM_EXTRACTION_CHANNELS,
+ (char *)"pcm_extraction_channels", /* set channels for pcm extraction */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) MM_SOUND_VOLUME_TYPE_MEDIA,
+ {(void *)1},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_SOUND_VOLUME_TYPE_SYSTEM,
- MM_SOUND_VOLUME_TYPE_CALL
+ {.int_min = 0},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "sound_route",
+ MMPLAYER_ATTRS_ACCURATE_SEEK,
+ (char *)"accurate_seek",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) MM_AUDIOROUTE_USE_EXTERNAL_SETTING,
+ {(void *)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_AUDIOROUTE_USE_EXTERNAL_SETTING,
- MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY
+ {.int_min = 0},
+ {.int_max = 1},
+ NULL,
},
{
- "sound_stop_when_unplugged",
- MM_ATTRS_TYPE_INT,
+ MMPLAYER_ATTRS_PCM_EXTRACTION_FORMAT,
+ (char *)"pcm_extraction_format",
+ MM_ATTRS_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- (void *) TRUE,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
},
{
- "sound_application_pid",
+ MMPLAYER_ATTRS_DRC_MODE,
+ (char *)"drc_mode",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 0,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
{
- "sound_spk_out_only",
+ 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,
},
{
- "sound_priority",
+ MMPLAYER_ATTRS_ENABLE_VIDEO_DECODED_CB,
+ (char *)"enable_video_decoded_cb",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 0, // 0: normal, 1: high 2: high with sound transition
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 2
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ __mmplayer_commit_enable_video_decoded_cb,
},
{
- "audio_latency_mode",
+ MMPLAYER_ATTRS_VIDEO_CODEC_TYPE,
+ (char *)"video_codec_type",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 1, // 0: low latency, 1: middle latency 2: high latency
+ {(void *)MM_PLAYER_CODEC_TYPE_HW},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 2
+ {.int_min = MM_PLAYER_CODEC_TYPE_HW},
+ {.int_max = MM_PLAYER_CODEC_TYPE_SW},
+ NULL,
},
{
- "pcm_extraction", // enable pcm extraction
+ MMPLAYER_ATTRS_AUDIO_CODEC_TYPE,
+ (char *)"audio_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,
},
{
- "pcm_extraction_samplerate", // set samplerate for pcm extraction
+ MMPLAYER_ATTRS_VIDEO_BUFFER_TOTAL_SIZE,
+ (char *)"video_buffer_total_size",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 8000, // hz
+ {(void *)DEFAULT_NUM_OF_V_OUT_BUFFER},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "pcm_extraction_depth", // set depth for pcm extraction
+ MMPLAYER_ATTRS_VIDEO_BUFFER_EXTRA_SIZE,
+ (char *)"video_buffer_extra_size",
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 16, // bits
+ {(void *)DEFAULT_NUM_OF_V_OUT_BUFFER},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MMPLAYER_MIN_INT},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "pcm_extraction_channels", // set channels for pcm extraction
+ MMPLAYER_ATTRS_PREBUFFER_MS,
+ (char *)"prebuffer_ms", /* user setting */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 1,
+ {(void *) MIN_BUFFERING_TIME},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MIN_BUFFERING_TIME},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "pcm_extraction_start_msec", // set start position to extract pcm
+ MMPLAYER_ATTRS_REBUFFER_MS,
+ (char *)"rebuffer_ms", /* user setting */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 0,
+ {(void *) MIN_BUFFERING_TIME},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = MIN_BUFFERING_TIME},
+ {.int_max = MMPLAYER_MAX_INT},
+ NULL,
},
{
- "pcm_extraction_end_msec", // set end position to extract pcm
+ MMPLAYER_ATTRS_PITCH_CONTROL,
+ (char *)"pitch_control", /* MM_PLAYER_PITCH_CONTROL */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 0,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
{
- "profile_smooth_repeat",
- MM_ATTRS_TYPE_INT,
+ MMPLAYER_ATTRS_PITCH_VALUE,
+ (char *)"pitch_value", /* MM_PLAYER_PITCH_VALUE */
+ MM_ATTRS_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- (void *) FALSE,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.value_double = 1.0},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {.double_min = 0.5},
+ {.double_max = 2},
+ __mmplayer_commit_audio_pitch_value,
},
{
- "profile_progress_interval", // will be deprecated
+ MMPLAYER_ATTRS_AUDIO_OFFLOAD,
+ (char *)"audio_offload", /* MM_PLAYER_AUDIO_OFFLOAD */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) 500,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
{
- "display_x",
+ 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 *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {.int_array = NULL},
+ {.count = 0},
+ NULL,
},
{
- "display_y",
+ 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 *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MMPLAYER_MAX_INT
+ {(void *)NULL},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {.int_array = NULL},
+ {.count = 0},
+ NULL,
},
{
- "pd_mode",
+ MMPLAYER_ATTRS_AUDIO_ONLY,
+ (char *)"audio_only", /* MM_PLAYER_AUDIO_ONLY */
MM_ATTRS_TYPE_INT,
MM_ATTRS_FLAG_RW,
- (void *) MM_PLAYER_PD_MODE_NONE,
+ {(void *)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_PLAYER_PD_MODE_NONE,
- MM_PLAYER_PD_MODE_URI // not tested yet, because of no fixed scenario
- },
- {
- "pd_location", // location of the file to write
- MM_ATTRS_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- (void *) NULL,
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
},
- {
- "accurate_seek",
- MM_ATTRS_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- (void *) 0,
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1
- }
};
+ MMPLAYER_RETURN_VAL_IF_FAIL(handle, 0);
+
num_of_attrs = ARRAY_SIZE(player_attrs);
- base = (mmf_attrs_construct_info_t* )malloc(num_of_attrs * sizeof(mmf_attrs_construct_info_t));
+ base = g_try_new(MMAttrsConstructInfo, num_of_attrs);
+ if (!base) {
+ LOGE("failed to alloc attrs constructor");
+ return NULL;
+ }
- if ( !base )
- {
- debug_error("failed to alloc attrs constructor");
- return 0;
+ /* 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;
+ for (idx = 0; idx < num_of_attrs; idx++) {
+ 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 */
}
- attrs = mmf_attrs_new_from_data(
- "mmplayer_attrs",
- base,
- num_of_attrs,
- NULL,
- NULL);
+ result = mm_attrs_new(base, num_of_attrs, "mmplayer_attrs",
+ _mmplayer_commit_attribute, (void *)handle, &attrs);
/* clean */
MMPLAYER_FREEIF(base);
- if ( !attrs )
- {
- debug_error("failed to create player attrs");
- return 0;
+ if (result != MM_ERROR_NONE) {
+ LOGE("failed to create player attrs");
+ goto ERROR;
}
/* set validity type and range */
- for ( idx = 0; idx < num_of_attrs; idx++ )
- {
- switch ( player_attrs[idx].valid_type)
- {
- case MM_ATTRS_VALID_TYPE_INT_RANGE:
- {
- mmf_attrs_set_valid_type (attrs, idx, MM_ATTRS_VALID_TYPE_INT_RANGE);
- mmf_attrs_set_valid_range (attrs, idx,
- player_attrs[idx].value_min,
- player_attrs[idx].value_max,
- (int)player_attrs[idx].default_value);
- }
+ for (idx = 0; idx < num_of_attrs; idx++) {
+ 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_range(attrs, idx,
+ 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:
- case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
- default:
+ case MM_ATTRS_VALID_TYPE_INT_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;
}
}
- /* set proxy and user agent */
- system_ua = vconf_get_str(VCONFKEY_ADMIN_UAGENT);
- system_proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
-
- if (system_ua)
- {
- mm_attrs_set_string_by_name(attrs, "streaming_user_agent", system_ua);
- g_free(system_ua);
+ /* commit */
+ if (mm_attrs_commit_all(attrs)) {
+ LOGE("failed to update attributes");
+ goto ERROR;
}
- if (system_proxy)
- {
- mm_attrs_set_string_by_name(attrs, "streaming_proxy", system_proxy);
- g_free(system_proxy);
- }
+ __mmplayer_release_ini_info(handle);
- /* commit */
- mmf_attrs_commit(attrs);
+ return attrs;
- debug_fleave();
+ERROR:
+ MMPLAYER_FREEIF(base);
+ MMPLAYER_FREEIF(player->default_attrs);
- return attrs;
+ if (attrs)
+ mm_attrs_free(attrs);
+
+ return NULL;
}
-bool
-_mmplayer_deconstruct_attribute(MMHandleType handle) // @
+bool _mmplayer_deconstruct_attribute(MMHandleType handle)
{
- debug_fenter();
-
- mm_player_t *player = MM_PLAYER_CAST(handle);
+ mmplayer_t *player = MM_PLAYER_CAST(handle);
- return_val_if_fail ( player, FALSE );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, false);
- if (player->attrs)
- {
- mmf_attrs_free (player->attrs);
- player->attrs = 0;
+ if (player->attrs) {
+ mm_attrs_free(player->attrs);
+ player->attrs = NULL;
}
- debug_fleave();
+ MMPLAYER_FREEIF(player->default_attrs);
- return TRUE;
+ return true;
}