#include "iniparser.h"
#include <mm_player_ini.h>
#include <mm_error.h>
+#include <mm_player_utils.h>
#include <glib/gstdio.h>
/* internal functions, macros here */
-#ifdef MM_PLAYER_DEFAULT_INI
-static gboolean __generate_default_ini(void);
-#endif
-static void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type);
+static void __get_element_list(mmplayer_ini_t *ini, const gchar *str, int keyword_type);
static void __mm_player_ini_check_ini_status(void);
/* macro */
#define MMPLAYER_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
-do { \
- gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
- if (str && \
- (strlen(str) > 0) && \
- (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
- strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
- else \
- strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
-} while (0)
+ do { \
+ const gchar *str = iniparser_getstring(x_dict, x_ini, x_default); \
+ if (str && \
+ (strlen(str) > 0) && \
+ (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
+ strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
+ else \
+ strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
+ } while (0)
#define MMPLAYER_INI_GET_COLOR(x_dict, x_item, x_ini, x_default) \
-do { \
- gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
- if (str && \
- (strlen(str) > 0) && \
- (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
- x_item = (guint) strtoul(str, NULL, 16); \
- else \
- x_item = (guint) strtoul(x_default, NULL, 16); \
-} while (0)
+ do { \
+ const gchar *str = iniparser_getstring(x_dict, x_ini, x_default); \
+ if (str && \
+ (strlen(str) > 0) && \
+ (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
+ x_item = (guint) strtoul(str, NULL, 16); \
+ else \
+ x_item = (guint) strtoul(x_default, NULL, 16); \
+ } while (0)
/* x_ini is the list of index to set TRUE at x_list[index] */
#define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
-do { \
- int index = 0; \
- const char *delimiters = " ,"; \
- char *usr_ptr = NULL; \
- char *token = NULL; \
- gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
- MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
- token = strtok_r(temp_arr, delimiters, &usr_ptr); \
- while (token) { \
- index = atoi(token); \
- if (index < 0 || index > x_list_max -1) \
- LOGW("%d is not valid index\n", index); \
- else \
- x_list[index] = TRUE; \
- token = strtok_r(NULL, delimiters, &usr_ptr); \
- } \
-} while (0)
+ do { \
+ int index = 0; \
+ const char *delimiters = " ,"; \
+ char *usr_ptr = NULL; \
+ char *token = NULL; \
+ gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
+ MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
+ token = strtok_r(temp_arr, delimiters, &usr_ptr); \
+ while (token) { \
+ index = atoi(token); \
+ if (index < 0 || index > x_list_max -1) \
+ LOGW("%d is not valid index", index); \
+ else \
+ x_list[index] = TRUE; \
+ token = strtok_r(NULL, delimiters, &usr_ptr); \
+ } \
+ } while (0)
/* x_ini is the list of value to be set at x_list[index] */
#define MMPLAYER_INI_GET_INT_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
-do { \
- int index = 0; \
- int value = 0; \
- const char *delimiters = " ,"; \
- char *usr_ptr = NULL; \
- char *token = NULL; \
- gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
- MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
- token = strtok_r(temp_arr, delimiters, &usr_ptr); \
- while (token) { \
- if (index > x_list_max -1) { \
- LOGE("%d is not valid index\n", index); \
- break; \
- } else { \
- value = atoi(token); \
- x_list[index] = value; \
- index++; \
+ do { \
+ int index = 0; \
+ int value = 0; \
+ const char *delimiters = " ,"; \
+ char *usr_ptr = NULL; \
+ char *token = NULL; \
+ gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0, }; \
+ MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
+ token = strtok_r(temp_arr, delimiters, &usr_ptr); \
+ while (token) { \
+ if (index > x_list_max -1) { \
+ LOGE("%d is not valid index", index); \
+ break; \
+ } else { \
+ value = atoi(token); \
+ x_list[index] = value; \
+ index++; \
+ } \
+ token = strtok_r(NULL, delimiters, &usr_ptr); \
} \
- token = strtok_r(NULL, delimiters, &usr_ptr); \
- } \
-} while (0)
+ } while (0)
int
-mm_player_ini_load(mm_player_ini_t* ini)
+mm_player_ini_load(mmplayer_ini_t *ini)
{
- dictionary * dict = NULL;
+ dictionary *dict = NULL;
gint idx = 0;
__mm_player_ini_check_ini_status();
/* first, try to load existing ini file */
dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
- /* if no file exists. create one with set of default values */
- if (!dict) {
-#ifdef MM_PLAYER_DEFAULT_INI
- LOGD("No inifile found. player will create default inifile.\n");
- if (FALSE == __generate_default_ini())
- LOGW("Creating default inifile failed. Player will use default values.\n");
- else
- dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH); /* load default ini */
-#else
- LOGD("No ini file found. \n");
- return MM_ERROR_FILE_NOT_FOUND;
-#endif
- }
-
/* get ini values */
- memset(ini, 0, sizeof(mm_player_ini_t));
+ memset(ini, 0, sizeof(mmplayer_ini_t));
if (dict) {
/* if dict is available */
ini->live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT);
ini->localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT);
ini->eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY);
- ini->async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START);
- ini->video_playback_supported = iniparser_getboolean(dict, "general:video playback supported", DEFAULT_VIDEO_PLAYBACK_SUPPORTED);
ini->delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
ini->pcm_buffer_size = iniparser_getint(dict, "general:pcm buffer size", DEFAULT_PCM_BUFFER_SIZE);
ini->num_of_video_bo = iniparser_getint(dict, "general:video bo max", DEFAULT_NUM_OF_VIDEO_BO);
ini->video_bo_timeout = iniparser_getint(dict, "general:video bo timeout", DEFAULT_TIMEOUT_OF_VIDEO_BO);
+ ini->use_decodebin = iniparser_getboolean(dict, "general:use decodebin", DEFAULT_USE_DECODEBIN);
+ ini->support_audio_effect = iniparser_getboolean(dict, "general:support audio effect", DEFAULT_SUPPORT_AUDIO_EFFECT);
+ ini->support_pcm_exporting = iniparser_getboolean(dict, "general:support pcm exporting", DEFAULT_SUPPORT_PCM_EXPORTING);
+ ini->support_pitch_control = iniparser_getboolean(dict, "general:use pitch control", DEFAULT_SUPPORT_PITCH_CONTROL);
+ ini->support_replaygain_control = iniparser_getboolean(dict, "general:use replaygain control", DEFAULT_SUPPORT_REPLAYGAIN_CONTROL);
MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER);
- MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_element_hw, "general:audio codec element hw", DEFAULT_CODEC_HW);
+ MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_element_hw, "general:audio codec element hw", DEFAULT_EMPTY_VALUE);
+ MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_default_type, "general:audio codec default type", DEFAULT_EMPTY_VALUE);
+ MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_EMPTY_VALUE);
+ MMPLAYER_INI_GET_STRING(dict, ini->videocodec_default_type, "general:video codec default type", DEFAULT_EMPTY_VALUE);
+
MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK);
+ MMPLAYER_INI_GET_STRING(dict, ini->audio_offload_sink_element, "general:audio offload sink element", DEFAULT_AUDIO_OFFLOAD_SINK);
+ MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER);
MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_overlay, "general:videosink element overlay", DEFAULT_VIDEOSINK_OVERLAY);
MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
- MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_CODEC_HW);
- MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER);
__get_element_list(ini,
- iniparser_getstring(dict, "general:audio codec element sw", DEFAULT_CODEC_SW), KEYWORD_A_SW_CODEC);
+ iniparser_getstring(dict, "general:audio codec element sw", DEFAULT_EMPTY_VALUE), KEYWORD_A_SW_CODEC);
__get_element_list(ini,
- iniparser_getstring(dict, "general:video codec element sw", DEFAULT_CODEC_SW), KEYWORD_V_SW_CODEC);
+ iniparser_getstring(dict, "general:video codec element sw", DEFAULT_EMPTY_VALUE), KEYWORD_V_SW_CODEC);
__get_element_list(ini,
iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_EXCLUDE);
__get_element_list(ini,
+ iniparser_getstring(dict, "general:audio offload device type", DEFAULT_A_OFFLOAD_DEVICE_TYPE), KEYWORD_A_OFFLOAD_DEVICE_TYPE);
+
+ __get_element_list(ini,
+ iniparser_getstring(dict, "general:audio offload media format", DEFAULT_EMPTY_VALUE), KEYWORD_A_OFFLOAD_MEDIA_FORMAT);
+
+ __get_element_list(ini,
+ iniparser_getstring(dict, "general:media stream input format", DEFAULT_EMPTY_VALUE), KEYWORD_MEDIA_STREAM_IN_FORMAT);
+
+ __get_element_list(ini,
iniparser_getstring(dict, "general:unsupported codec keyword", DEFAULT_UNSUPPORTED_CODEC_KEYWORD), KEYWORD_UNSUPPORTED_CODEC);
MMPLAYER_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM);
/* http streaming */
MMPLAYER_INI_GET_STRING(dict, ini->httpsrc_element, "http streaming:httpsrc element", DEFAULT_HTTPSRC);
- ini->http_use_file_buffer = iniparser_getboolean(dict, "http streaming:http use file buffer", DEFAULT_HTTP_USE_FILE_BUFFER);
ini->http_ring_buffer_size = iniparser_getint(dict, "http streaming:http ring buffer size", DEFAULT_HTTP_RING_BUFFER_SIZE);
- ini->http_max_size_bytes = iniparser_getint(dict, "http streaming:http max size bytes", DEFAULT_HTTP_MAX_SIZE_BYTES);
- ini->http_buffering_time = (gint)(iniparser_getdouble(dict, "http streaming:http buffering time", DEFAULT_HTTP_BUFFERING_TIME) * 1000);
ini->http_timeout = iniparser_getint(dict, "http streaming:http timeout", DEFAULT_HTTP_TIMEOUT);
/* dump buffer for debug */
MMPLAYER_INI_GET_STRING(dict, ini->dump_element_path, "general:dump element path", DEFAULT_DUMP_ELEMENT_PATH);
} else {
/* if dict is not available just fill the structure with default value */
- LOGW("failed to load ini. using hardcoded default\n");
+ LOGW("failed to load ini. using hardcoded default");
/* general */
ini->disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
ini->skip_rescan = DEFAULT_SKIP_RESCAN;
- strncpy(ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1);
- strncpy(ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1);
ini->generate_dot = DEFAULT_GENERATE_DOT;
ini->use_system_clock = DEFAULT_USE_SYSTEM_CLOCK;
ini->live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
ini->localplayback_state_change_timeout = DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT;
ini->eos_delay = DEFAULT_EOS_DELAY;
- ini->async_start = DEFAULT_ASYNC_START;
ini->delay_before_repeat = DEFAULT_DELAY_BEFORE_REPEAT;
- ini->video_playback_supported = DEFAULT_VIDEO_PLAYBACK_SUPPORTED;
ini->pcm_buffer_size = DEFAULT_PCM_BUFFER_SIZE;
ini->num_of_video_bo = DEFAULT_NUM_OF_VIDEO_BO;
ini->video_bo_timeout = DEFAULT_TIMEOUT_OF_VIDEO_BO;
+ ini->use_decodebin = DEFAULT_USE_DECODEBIN;
+ ini->support_audio_effect = DEFAULT_SUPPORT_AUDIO_EFFECT;
+ ini->support_pcm_exporting = DEFAULT_SUPPORT_PCM_EXPORTING;
+ ini->support_pitch_control = DEFAULT_SUPPORT_PITCH_CONTROL;
+ ini->support_replaygain_control = DEFAULT_SUPPORT_REPLAYGAIN_CONTROL;
+
+ strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->audiocodec_element_hw, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->audiocodec_default_type, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->videocodec_element_hw, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->videocodec_default_type, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1);
+
+ strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->audio_offload_sink_element, DEFAULT_AUDIO_OFFLOAD_SINK, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1);
+ strncpy(ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1);
- strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1);
- strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1);
- strncpy(ini->audiocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
- strncpy(ini->videocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
- strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1);
-
- __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_A_SW_CODEC);
- __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_V_SW_CODEC);
+ __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_A_SW_CODEC);
+ __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_V_SW_CODEC);
+ __get_element_list(ini, DEFAULT_A_OFFLOAD_DEVICE_TYPE, KEYWORD_A_OFFLOAD_DEVICE_TYPE);
+ __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_A_OFFLOAD_MEDIA_FORMAT);
+ __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_MEDIA_STREAM_IN_FORMAT);
__get_element_list(ini, DEFAULT_EXCLUDE_KEYWORD, KEYWORD_EXCLUDE);
__get_element_list(ini, DEFAULT_UNSUPPORTED_CODEC_KEYWORD, KEYWORD_UNSUPPORTED_CODEC);
/* http streaming */
strncpy(ini->httpsrc_element, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1);
- ini->http_use_file_buffer = DEFAULT_HTTP_USE_FILE_BUFFER;
ini->http_ring_buffer_size = DEFAULT_HTTP_RING_BUFFER_SIZE;
- ini->http_max_size_bytes = DEFAULT_HTTP_MAX_SIZE_BYTES;
- ini->http_buffering_time = (gint)(DEFAULT_HTTP_BUFFERING_TIME*1000);
ini->http_timeout = DEFAULT_HTTP_TIMEOUT;
/* dump buffer for debug */
iniparser_freedict(dict);
/* dump structure */
- LOGD("player settings -----------------------------------\n");
+ LOGD("player settings -----------------------------------");
/* general */
- LOGD("disable segtrap : %d\n", ini->disable_segtrap);
- LOGD("skip rescan : %d\n", ini->skip_rescan);
- LOGD("videosink element overlay: %s\n", ini->videosink_element_overlay);
- LOGD("videosink element fake: %s\n", ini->videosink_element_fake);
- LOGD("video converter element : %s\n", ini->videoconverter_element);
- LOGD("video codec element(hw) : %s\n", ini->videocodec_element_hw);
+ LOGD("disable segtrap : %d", ini->disable_segtrap);
+ LOGD("skip rescan : %d", ini->skip_rescan);
+ LOGD("videosink element overlay: %s", ini->videosink_element_overlay);
+ LOGD("videosink element fake: %s", ini->videosink_element_fake);
+ LOGD("video converter element : %s", ini->videoconverter_element);
+ LOGD("video codec element(hw) : %s", ini->videocodec_element_hw);
for (idx = 0; ini->videocodec_element_sw[idx][0] != '\0'; idx++)
- LOGD("video codec element(sw%d) %s\n", idx, ini->videocodec_element_sw[idx]);
- LOGD("audio codec element(hw) : %s\n", ini->audiocodec_element_hw);
+ LOGD("video codec element(sw%d) %s", idx, ini->videocodec_element_sw[idx]);
+ LOGD("audio codec element(hw) : %s", ini->audiocodec_element_hw);
for (idx = 0; ini->audiocodec_element_sw[idx][0] != '\0'; idx++)
- LOGD("audio codec element(sw%d) %s\n", idx, ini->audiocodec_element_sw[idx]);
- LOGD("audio resampler element : %s\n", ini->audioresampler_element);
- LOGD("audiosink element : %s\n", ini->audiosink_element);
- LOGD("generate dot : %d\n", ini->generate_dot);
- LOGD("use system clock(video only) : %d\n", ini->use_system_clock);
- LOGD("live state change timeout(sec) : %d\n", ini->live_state_change_timeout);
- LOGD("localplayback state change timeout(sec) : %d\n", ini->localplayback_state_change_timeout);
- LOGD("eos_delay(msec) : %d\n", ini->eos_delay);
- LOGD("delay before repeat(msec) : %d\n", ini->delay_before_repeat);
- LOGD("async_start : %d\n", ini->async_start);
- LOGD("video_playback_supported : %d\n", ini->video_playback_supported);
- LOGD("pcm buffer size(bytes) : %d\n", ini->pcm_buffer_size);
- LOGD("num of video bo : %d\n", ini->num_of_video_bo);
- LOGD("video bo timeout : %d\n", ini->video_bo_timeout);
- LOGD("gst param1 : %s\n", ini->gst_param[0]);
- LOGD("gst param2 : %s\n", ini->gst_param[1]);
- LOGD("gst param3 : %s\n", ini->gst_param[2]);
- LOGD("gst param4 : %s\n", ini->gst_param[3]);
- LOGD("gst param5 : %s\n", ini->gst_param[4]);
+ LOGD("audio codec element(sw%d) %s", idx, ini->audiocodec_element_sw[idx]);
+ LOGD("audio resampler element : %s", ini->audioresampler_element);
+ LOGD("audiosink element : %s", ini->audiosink_element);
+ LOGD("audio offload sink element : %s", ini->audio_offload_sink_element);
+ for (idx = 0; ini->audio_offload_device_type[idx][0] != '\0'; idx++)
+ LOGD("audio_offload_device_type [%d] : %s", idx, ini->audio_offload_device_type[idx]);
+ for (idx = 0; ini->audio_offload_media_format[idx][0] != '\0'; idx++)
+ LOGD("audio_offload_media_format [%d] : %s", idx, ini->audio_offload_media_format[idx]);
+ for (idx = 0; ini->media_stream_input_format[idx][0] != '\0'; idx++)
+ LOGD("media_stream_input_format [%d] : %s", idx, ini->media_stream_input_format[idx]);
+ LOGD("generate dot : %d", ini->generate_dot);
+ LOGD("use system clock(video only) : %d", ini->use_system_clock);
+ LOGD("live state change timeout(sec) : %d", ini->live_state_change_timeout);
+ LOGD("localplayback state change timeout(sec) : %d", ini->localplayback_state_change_timeout);
+ LOGD("eos_delay(msec) : %d", ini->eos_delay);
+ LOGD("delay before repeat(msec) : %d", ini->delay_before_repeat);
+ LOGD("pcm buffer size(bytes) : %d", ini->pcm_buffer_size);
+ LOGD("num of video bo : %d", ini->num_of_video_bo);
+ LOGD("video bo timeout : %d", ini->video_bo_timeout);
+ LOGD("gst param1 : %s", ini->gst_param[0]);
+ LOGD("gst param2 : %s", ini->gst_param[1]);
+ LOGD("gst param3 : %s", ini->gst_param[2]);
+ LOGD("gst param4 : %s", ini->gst_param[3]);
+ LOGD("gst param5 : %s", ini->gst_param[4]);
+ LOGD("use decodebin : %d", ini->use_decodebin);
for (idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++)
- LOGD("exclude_element_keyword [%d] : %s\n", idx, ini->exclude_element_keyword[idx]);
+ LOGD("exclude_element_keyword [%d] : %s", idx, ini->exclude_element_keyword[idx]);
for (idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++)
- LOGD("dump_element_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
+ LOGD("dump_element_keyword [%d] : %s", idx, ini->dump_element_keyword[idx]);
for (idx = 0; ini->unsupported_codec_keyword[idx][0] != '\0'; idx++)
- LOGD("unsupported_codec_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
+ LOGD("unsupported_codec_keyword [%d] : %s", idx, ini->unsupported_codec_keyword[idx]);
/* http streaming */
- LOGD("httpsrc element : %s\n", ini->httpsrc_element);
- LOGD("http use file buffer : %d \n", ini->http_use_file_buffer);
- LOGD("http ring buffer size : %d \n", ini->http_ring_buffer_size);
- LOGD("http max_size bytes : %d \n", ini->http_max_size_bytes);
- LOGD("http buffering time : %d \n", ini->http_buffering_time);
- LOGD("http timeout : %d \n", ini->http_timeout);
+ LOGD("httpsrc element : %s", ini->httpsrc_element);
+ LOGD("http ring buffer size : %d", ini->http_ring_buffer_size);
+ LOGD("http timeout : %d", ini->http_timeout);
return MM_ERROR_NONE;
}
int
-mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
+mm_player_audio_effect_ini_load(mmplayer_ini_t *ini)
{
- dictionary * dict_audioeffect = NULL;
+ dictionary *dict_audioeffect = NULL;
dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
if (!dict_audioeffect) {
- LOGE("No audio effect ini file found. \n");
+ LOGE("No audio effect ini file found.");
return MM_ERROR_FILE_NOT_FOUND;
}
/* audio effect element name */
MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT);
if (!ini->audioeffect_element[0]) {
- LOGW("could not parse name of audio effect. \n");
+ LOGW("could not parse name of audio effect.");
iniparser_freedict(dict_audioeffect);
/* NOTE : in this case, we are not going to create audio filter element */
return MM_ERROR_NONE;
/* audio effect element name */
MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT);
if (!ini->audioeffect_element_custom[0])
- LOGW("no secondary audio effect \n");
+ LOGW("no secondary audio effect");
else
- LOGD("audioeffect element custom : %s\n", ini->audioeffect_element_custom);
+ LOGD("audioeffect element custom : %s", ini->audioeffect_element_custom);
/* dump structure */
- LOGD("audioeffect element : %s\n", ini->audioeffect_element);
- LOGD("audio effect preset mode : %d\n", ini->use_audio_effect_preset);
- LOGD("audio effect custom mode : %d\n", ini->use_audio_effect_custom);
-#if 0 // debug
+ LOGD("audioeffect element : %s", ini->audioeffect_element);
+ LOGD("audio effect preset mode : %d", ini->use_audio_effect_preset);
+ LOGD("audio effect custom mode : %d", ini->use_audio_effect_custom);
+#ifdef __DEBUG__
int i;
for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++)
- LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))\n", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
+ LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
- LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))\n", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
- LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
+ LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
+ LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
LOGD("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
for (i = 0; i < ini->audio_effect_custom_eq_band_num; i++)
LOGD(" EQ band index(%d) : %8d / %8d", i, ini->audio_effect_custom_eq_band_width[i], ini->audio_effect_custom_eq_band_freq[i]);
for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
- LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)\n", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
+ LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
#endif
iniparser_freedict(dict_audioeffect);
}
-static
-void __mm_player_ini_check_ini_status(void)
+static void
+__mm_player_ini_check_ini_status(void)
{
struct stat ini_buff;
if (g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0) {
- LOGW("failed to get player ini status\n");
+ LOGW("failed to get player ini status");
} else {
if (ini_buff.st_size < 5) {
- LOGW("player.ini file size=%d, Corrupted!So, Removed\n", (int)ini_buff.st_size);
+ LOGW("player.ini file size=%d, Corrupted!So, Removed", (int)ini_buff.st_size);
if (g_remove(MM_PLAYER_INI_DEFAULT_PATH) == -1)
LOGE("failed to delete corrupted ini");
}
}
-#ifdef MM_PLAYER_DEFAULT_INI
-static
-gboolean __generate_default_ini(void)
+static void
+__get_element_list(mmplayer_ini_t *ini, const gchar *str, int keyword_type)
{
- FILE* fp = NULL;
- gchar* default_ini = MM_PLAYER_DEFAULT_INI;
-
-
- /* create new file */
- fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
-
- if (!fp)
- return FALSE;
-
- /* writing default ini file */
- if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
- fclose(fp);
- return FALSE;
- }
-
- fclose(fp);
- return TRUE;
-}
-#endif
-
-static
-void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
-{
- gchar** list = NULL;
- gchar** walk = NULL;
+ gchar **list = NULL;
+ gchar **walk = NULL;
gint i = 0;
- gchar* strtmp = NULL;
+ gint size = PLAYER_INI_MAX_ELEMENT;
+ gchar *strtmp = NULL;
+ gchar (*ini_keyword)[PLAYER_INI_MAX_STRLEN] = {NULL, };
if (!str)
return;
/* trimming. it works inplace */
g_strstrip(strtmp);
-
/* split */
list = g_strsplit(strtmp, ",", 10);
if (!list) {
- if (strtmp)
- g_free(strtmp);
-
+ MMPLAYER_FREEIF(strtmp);
return;
}
/* copy list */
switch (keyword_type) {
case KEYWORD_EXCLUDE:
- {
- for (walk = list; *walk; walk++) {
- strncpy(ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
- g_strstrip(ini->exclude_element_keyword[i]);
-
- ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
- i++;
- }
- /* mark last item to NULL */
- ini->exclude_element_keyword[i][0] = '\0';
-
+ ini_keyword = ini->exclude_element_keyword;
break;
- }
case KEYWORD_DUMP:
- {
- for (walk = list; *walk; walk++) {
- strncpy(ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
- g_strstrip(ini->dump_element_keyword[i]);
-
- ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
- i++;
- }
- /* mark last item to NULL */
- ini->dump_element_keyword[i][0] = '\0';
-
+ ini_keyword = ini->dump_element_keyword;
break;
- }
case KEYWORD_UNSUPPORTED_CODEC:
- {
- for (walk = list; *walk; walk++) {
- strncpy(ini->unsupported_codec_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
- g_strstrip(ini->unsupported_codec_keyword[i]);
-
- ini->unsupported_codec_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
- i++;
- }
- /* mark last item to NULL */
- ini->unsupported_codec_keyword[i][0] = '\0';
+ ini_keyword = ini->unsupported_codec_keyword;
break;
- }
case KEYWORD_V_SW_CODEC:
- {
- for (walk = list; *walk; walk++) {
- strncpy(ini->videocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
- g_strstrip(ini->videocodec_element_sw[i]);
-
- ini->videocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
- i++;
- }
- /* mark last item to NULL */
- ini->videocodec_element_sw[i][0] = '\0';
+ ini_keyword = ini->videocodec_element_sw;
break;
- }
case KEYWORD_A_SW_CODEC:
- {
- for (walk = list; *walk; walk++) {
- strncpy(ini->audiocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
- g_strstrip(ini->audiocodec_element_sw[i]);
-
- ini->audiocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
- i++;
- }
- /* mark last item to NULL */
- ini->audiocodec_element_sw[i][0] = '\0';
+ ini_keyword = ini->audiocodec_element_sw;
+ break;
+ case KEYWORD_A_OFFLOAD_DEVICE_TYPE:
+ ini_keyword = ini->audio_offload_device_type;
+ size = PLAYER_INI_MAX_DEVICE_TYPE;
+ break;
+ case KEYWORD_A_OFFLOAD_MEDIA_FORMAT:
+ ini_keyword = ini->audio_offload_media_format;
+ size = PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT;
+ break;
+ case KEYWORD_MEDIA_STREAM_IN_FORMAT:
+ ini_keyword = ini->media_stream_input_format;
+ size = PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT;
break;
- }
-
default:
+ goto EXIT;
break;
}
+ for (walk = list; *walk && i < size; walk++) {
+ strncpy(ini_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
+ g_strstrip(ini_keyword[i]);
+ ini_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
+ i++;
+ }
+
+ /* mark last item to NULL */
+ if (i < size) {
+ ini_keyword[i][0] = '\0';
+ } else {
+ LOGE("too many keyword exist in list (%d)", i);
+ if (i > 0)
+ ini_keyword[i-1][0] = '\0';
+ }
+
+EXIT:
g_strfreev(list);
- if (strtmp)
- g_free(strtmp);
+ MMPLAYER_FREEIF(strtmp);
}
#endif