Name: libmm-player
Summary: Multimedia Framework Player Library
-Version: 0.6.199
+Version: 0.6.200
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
} mmplayer_subtitle_stream_info_t;
/**
- * selected subtitle track number callback function type.
- *
- * @param track_num [in] Track number of subtitle
- * @param user_param [in] User defined parameter
- *
- *
- * @return This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
-
-/**
* Called to notify the stream changed.
- *
- * @param user_data [in] The user data passed from the callback registration function
- *
- * @return This callback function have to return MM_ERROR_NONE.
*/
typedef bool (*mm_player_stream_changed_callback)(void *user_param);
/**
* Video decoded callback function type.
- *
- * @param stream [in] Reference pointer to video frame data
- * @param stream_size [in] Size of video frame data
- * @param user_param [in] User defined parameter which is passed when set
- * video stream callback
- * @param width [in] width of video frame
- * @param height [in] height of video frame
- *
- * @return This callback function have to return MM_ERROR_NONE.
*/
typedef bool (*mm_player_video_decoded_callback)(void *stream, void *user_param);
/**
* Audio stream callback function type.
- *
- * @param stream [in] Reference pointer to audio frame data
- * @param stream_size [in] Size of audio frame data
- * @param user_param [in] User defined parameter which is passed when set
- * audio stream callback
- *
- * @return This callback function have to return MM_ERROR_NONE.
*/
typedef bool (*mm_player_video_capture_callback)(void *stream, int stream_size, void *user_param);
/**
- * Video frame render error callback function type.
- *
- * @param error_id [in] cause of error
- * @param user_param [in] User defined parameter which is passed when set
- * video frame render error callback
- *
- * @return This callback function have to return MM_ERROR_NONE.
- */
-typedef bool (*mm_player_video_frame_render_error_callback)(void *error_id, void *user_param);
-
-/**
* Audio stream callback function type.
- *
- * @param stream [in] Reference pointer to audio frame data
- * @param user_param [in] User defined parameter which is passed when set
- * audio stream callback
- *
- * @return This callback function have to return MM_ERROR_NONE.
*/
typedef bool (*mm_player_audio_decoded_callback)(void *stream, void *user_param);
int mm_player_set_client_pid(MMHandleType player, int pid);
/**
+ * This function gets the activation status of audio offload.
+ */
+int mm_player_audio_offload_is_activated(MMHandleType player, bool *activated);
+
+/**
@}
*/
MMPLAYER_ATTRS_PITCH_CONTROL,
MMPLAYER_ATTRS_PITCH_VALUE, /* 60 */
MMPLAYER_ATTRS_AUDIO_OFFLOAD,
+ MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT,
MMPLAYER_ATTRS_NUM
} mmplayer_attrs_id_e;
#define MM_PLAYER_INI_DEFAULT_PATH SYSCONFDIR"/multimedia/mmfw_player.ini" /* SYSCONFDIR is defined at .spec */
#define MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH SYSCONFDIR"/multimedia/mmfw_player_audio_effect.ini" /* SYSCONFDIR is defined at .spec */
-#define PLAYER_INI_MAX_STRLEN 100
-#define PLAYER_INI_MAX_PARAM_STRLEN 256
+#define PLAYER_INI_MAX_STRLEN 100
+#define PLAYER_INI_MAX_PARAM_STRLEN 256
-#define PLAYER_INI_MAX_ELEMENT 10
+#define PLAYER_INI_MAX_ELEMENT 10
+#define PLAYER_INI_MAX_DEVICE_TYPE 10
+#define PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT 10 /* @see MAX_SUPPORTED_MEDIA_FORMAT in player_private.h */
/* NOTE : MMPlayer has no initalizing API for library itself
* so we cannot decide when those ini values to be released.
KEYWORD_UNSUPPORTED_CODEC, // for un-supported codec
KEYWORD_A_SW_CODEC, // for audio sw codec
KEYWORD_V_SW_CODEC, // for video sw codec
- KEYWORD_A_OFFLOAD, // for audio device type which can support offload
+ KEYWORD_A_OFFLOAD_DEVICE_TYPE, // for audio device type which can support offload
+ KEYWORD_A_OFFLOAD_MEDIA_FORMAT, // supported media format for audio offload
};
typedef struct {
gchar audioresampler_element[PLAYER_INI_MAX_STRLEN];
gchar audiosink_element[PLAYER_INI_MAX_STRLEN];
gchar audio_offload_sink_element[PLAYER_INI_MAX_STRLEN];
- gchar audio_offload_device_type[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
+ gchar audio_offload_device_type[PLAYER_INI_MAX_DEVICE_TYPE][PLAYER_INI_MAX_STRLEN];
+ gchar audio_offload_media_format[PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT][PLAYER_INI_MAX_STRLEN];
gboolean skip_rescan;
gboolean generate_dot;
gboolean use_system_clock;
/* default values if each values are not specified in inifile */
/* general */
+#define DEFAULT_EMPTY_VALUE ""
#define DEFAULT_AUDIO_EFFECT_ELEMENT ""
#define DEFAULT_USE_AUDIO_EFFECT_PRESET FALSE
#define DEFAULT_AUDIO_EFFECT_PRESET_LIST ""
int _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled);
int _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_y, double scale_width, double scale_height);
int _mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scale_y, double *scale_width, double *scale_height);
+int _mmplayer_audio_offload_is_activated(MMHandleType hplayer, bool *activated);
/* internal */
void _mmplayer_bus_msg_thread_destroy(MMHandleType hplayer);
MMPLAYER_CMD_UNLOCK(player);
return result;
-}
\ No newline at end of file
+}
+
+int mm_player_audio_offload_is_activated(MMHandleType player, bool *activated)
+{
+ int result = MM_ERROR_NONE;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(activated, MM_ERROR_INVALID_ARGUMENT);
+
+ MMPLAYER_CMD_LOCK(player);
+
+ result = _mmplayer_audio_offload_is_activated(player, activated);
+
+ MMPLAYER_CMD_UNLOCK(player);
+
+ return result;
+}
{.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,
+ },
};
/*===========================================================================================
return true;
}
+static int __mmplayer_get_array_count(MMHandleType handle, int type)
+{
+ mmplayer_t *player = (mmplayer_t *)handle;
+
+ int count = 0;
+ int i = 0;
+
+ if (type == KEYWORD_A_OFFLOAD_MEDIA_FORMAT) {
+ while (player->ini.audio_offload_media_format[i++][0])
+ count++;
+ }
+ return count;
+}
+
+static media_format_mimetype_e __mmplayer_get_supported_format_mimetype(MMHandleType handle, int type, int i)
+{
+ char *name = NULL;
+ media_format_mimetype_e format = MEDIA_FORMAT_MAX;
+
+ mmplayer_t *player = (mmplayer_t *)handle;
+
+ if (type == KEYWORD_A_OFFLOAD_MEDIA_FORMAT) {
+ name = player->ini.audio_offload_media_format[i];
+ } else {
+ LOGE("invalid ini type");
+ goto EXIT;
+ }
+
+ if (!strcmp(name, "MP3"))
+ format = MEDIA_FORMAT_MP3;
+ 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));
+ if (arr == NULL) {
+ LOGE("malloc failed : %zu", count * sizeof(int));
+ return -1;
+ }
+
+ for (i = 0 ; i < count ; i++) {
+ fmt = __mmplayer_get_supported_format_mimetype(handle, type, i);
+ if (fmt != MEDIA_FORMAT_MAX)
+ arr[total_count++] = fmt;
+ }
+
+ 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)
+{
+ 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_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_1.int_array = format;
+ player_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_2.count = total_count;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+static int __mmplayer_release_ini_info(void)
+{
+ int *mem = NULL;
+
+ MMPLAYER_FENTER();
+
+ mem = (int *)(player_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_1.int_array);
+ if (mem) {
+ free(mem);
+ player_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT].validity_value_1.int_array = NULL;
+ player_attrs[MMPLAYER_ATTRS_AUDIO_OFFLOAD_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) {
return NULL;
}
+ __mmplayer_set_ini_to_valid_info(handle);
+
/* set validity type and range */
for (idx = 0; idx < num_of_attrs; idx++) {
mm_attrs_set_valid_type(attrs, idx, player_attrs[idx].valid_type);
return NULL;
}
+ __mmplayer_release_ini_info();
+
return attrs;
}
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);
+ 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:unsupported codec keyword", DEFAULT_UNSUPPORTED_CODEC_KEYWORD), KEYWORD_UNSUPPORTED_CODEC);
__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_A_OFFLOAD_DEVICE_TYPE, KEYWORD_A_OFFLOAD);
+ __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_EXCLUDE_KEYWORD, KEYWORD_EXCLUDE);
__get_element_list(ini, DEFAULT_UNSUPPORTED_CODEC_KEYWORD, KEYWORD_UNSUPPORTED_CODEC);
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]);
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);
case KEYWORD_A_SW_CODEC:
ini_keyword = ini->audiocodec_element_sw;
break;
- case KEYWORD_A_OFFLOAD:
+ case KEYWORD_A_OFFLOAD_DEVICE_TYPE:
ini_keyword = ini->audio_offload_device_type;
break;
+ case KEYWORD_A_OFFLOAD_MEDIA_FORMAT:
+ ini_keyword = ini->audio_offload_media_format;
+ break;
default:
goto EXIT;
break;
return TRUE;
}
+int _mmplayer_audio_offload_is_activated(MMHandleType hplayer, bool *activated)
+{
+ mmplayer_t *player = (mmplayer_t *)hplayer;
+
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(activated, MM_ERROR_INVALID_ARGUMENT);
+
+ *activated = player->build_audio_offload;
+
+ LOGD("offload activated : %d", (int)*activated);
+
+ MMPLAYER_FLEAVE();
+ return MM_ERROR_NONE;
+}
+
+static gboolean
+__mmplayer_is_offload_supported_type(mmplayer_t *player)
+{
+ /* NOTE :
+ this function need to be updated according to the supported media format
+ @see player->ini.audio_offload_media_format */
+
+ if (__mmplayer_is_only_mp3_type(player->type)) {
+ LOGD("offload supportable media format type");
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
__mmplayer_can_build_audio_offload_path(mmplayer_t *player)
{
MMPLAYER_RETURN_VAL_IF_FAIL(player && player->attrs, FALSE);
LOGD("current stream : %s, sink: %s", player->type, player->ini.audio_offload_sink_element);
- if (!__mmplayer_is_only_mp3_type(player->type))
+ if (!__mmplayer_is_offload_supported_type(player))
goto DONE;
if (!strcmp(player->ini.audio_offload_sink_element, "")) {