}
if (player->duration < 0) {
- LOGW("duration : %lld is Non-Initialized !!! \n",player->duration);
+ LOGW("duration : %lld is Non-Initialized !!! \n", player->duration);
player->duration = 0;
}
/* rtsp case, get content attrs by GstMessage */
if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
/* it's first time to update all content attrs. */
- _mmplayer_update_content_attrs( player, ATTR_ALL );
+ _mmplayer_update_content_attrs(player, ATTR_ALL);
}
/* set max sound priority to keep own sound and not to mute other's one */
/* rtsp streaming pause makes rtsp server stop sending data. */
if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
LOGD("set pause state during buffering\n");
- __gst_pause( player, TRUE );
+ __gst_pause(player, TRUE);
}
}
}
case MM_PLAYER_STATE_PLAYING:
/* rtsp streaming pause makes rtsp server stop sending data. */
if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
- __gst_pause ( player, TRUE );
+ __gst_pause(player, TRUE);
}
break;
__mmplayer_adaptive_var_info(const VariantData *self, gpointer user_data)
{
VariantData *var_info = NULL;
- g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail(self != NULL, NULL);
var_info = g_new0(VariantData, 1);
if (!var_info) return NULL;
if ((GST_TIME_AS_SECONDS(player->last_position) <= 0) && (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED)) {
msg_param.connection.buffering = player->streamer->buffering_percent;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_BUFFERING, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
} else {
LOGD("Not updating Buffering Message for Live RTSP case !!!\n");
}
} else {
msg_param.connection.buffering = player->streamer->buffering_percent;
- MMPLAYER_POST_MSG( player, MM_MESSAGE_BUFFERING, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
}
}
MMPLAYER_CMD_UNLOCK(player);
int retVal = MM_ERROR_NONE;
LOGD("trying to play from (%lu) pending position\n", player->pending_seek.pos);
- retVal = __gst_set_position( player, player->pending_seek.format, player->pending_seek.pos, TRUE );
+ retVal = __gst_set_position(player, player->pending_seek.format, player->pending_seek.pos, TRUE);
if (MM_ERROR_NONE != retVal)
LOGE("failed to seek pending postion. just keep staying current position.\n");
if (MMPLAYER_IS_RTSP_STREAMING(player) && (MMPLAYER_IS_LIVE_STREAMING(player))) {
- LOGD("Current Buffering Percent = %d",player->streamer->buffering_percent);
+ LOGD("Current Buffering Percent = %d", player->streamer->buffering_percent);
if (player->streamer->buffering_percent < 100) {
MMMessageParamType msg_param = {0, };
LOGW("Posting Buffering Completed Message to Application !!!");
msg_param.connection.buffering = 100;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_BUFFERING, &msg_param );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
}
}
}
extract duration ,codec info , resolution from sdp and get it by GstMessage */
if (!strcmp(structure_name, "rtspsrc_properties")) {
- gchar *audio_codec = NULL;
- gchar *video_codec = NULL;
- gchar *video_frame_size = NULL;
+ gchar *audio_codec = NULL;
+ gchar *video_codec = NULL;
+ gchar *video_frame_size = NULL;
gst_structure_get(gst_message_get_structure(msg), "rtsp_duration", G_TYPE_UINT64, &player->duration, NULL);
LOGD("rtsp duration : %lld msec", GST_TIME_AS_MSECONDS(player->duration));
char *seperator = strchr(video_frame_size, '-');
if (seperator) {
- char video_width[10]={0,};
+ char video_width[10] = {0,};
int frame_size_len = strlen(video_frame_size);
int separtor_len = strlen(seperator);
- strncpy(video_width,video_frame_size,(frame_size_len-separtor_len));
+ strncpy(video_width, video_frame_size, (frame_size_len - separtor_len));
mm_attrs_set_int_by_name(attrs, "content_video_width", atoi(video_width));
seperator++;
}
/* link it */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGE("failed to link autoplug element\n");
goto ERROR;
}
}
/* link */
- if (GST_PAD_LINK_OK != GST_PAD_LINK(pad, sinkpad)) {
+ if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
LOGE("failed to get pad from sinkbin\n");
goto ERROR;
}
}
if (prv_element && prv_element->gst) {
- if (GST_ELEMENT_LINK(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst))) {
+ if (gst_element_link(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst))) {
LOGD("linking [%s] to [%s] success\n",
GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
MMPLAYER_RETURN_VAL_IF_FAIL(buffer, FALSE);
- if (player->is_subtitle_force_drop)
- {
+ if (player->is_subtitle_force_drop) {
LOGW("subtitle is dropped forcedly.");
return ret;
}
/* parsing cookies */
if ((cookie_list = util_get_cookie_list((const char*)cookies))) {
g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
- g_strfreev (cookie_list);
+ g_strfreev(cookie_list);
}
if (user_agent)
g_object_set(G_OBJECT(element), "user-agent", user_agent, NULL);
g_object_set(G_OBJECT(element), "location", player->profile.uri, NULL);
g_object_get(element, "location", &location, NULL);
LOGD("PD_LOCATION [%s].\n", location);
- if(location)
+ if (location)
g_free(location);
}
}
* Since some element could have some timing problemn with quering duration, try again.
*/
if (!player->duration) {
- if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec))
- {
+ if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec)) {
/* For RTSP Streaming , duration is not returned in READY state. So seek to the previous position does not work properly.
* Added a patch to postpone the actual seek when state changes to PLAY. Sending a fake SEEK_COMPLETED event to finish the current request. */
- if ((MMPLAYER_IS_RTSP_STREAMING( player )) && (__mmplayer_get_stream_service_type(player) != STREAMING_SERVICE_LIVE)) {
+ if ((MMPLAYER_IS_RTSP_STREAMING(player)) && (__mmplayer_get_stream_service_type(player) != STREAMING_SERVICE_LIVE)) {
player->pending_seek.is_pending = TRUE;
player->pending_seek.format = format;
player->pending_seek.pos = position;
player->doing_seek = FALSE;
- MMPLAYER_POST_MSG ( player, MM_MESSAGE_SEEK_COMPLETED, NULL );
+ MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
return MM_ERROR_NONE;
} else {
goto SEEK_ERROR;
if (position > dur_msec)
goto INVALID_ARGS;
- query = gst_query_new_seeking (GST_FORMAT_TIME);
- if (gst_element_query (player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, query)) {
- gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
- gst_query_unref (query);
+ query = gst_query_new_seeking(GST_FORMAT_TIME);
+ if (gst_element_query(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, query)) {
+ gst_query_parse_seeking(query, NULL, &seekable, NULL, NULL);
+ gst_query_unref(query);
if (!seekable) {
LOGW("non-seekable content");
}
} else {
LOGW("failed to get seeking query");
- gst_query_unref (query); /* keep seeking operation */
+ gst_query_unref(query); /* keep seeking operation */
}
LOGD("seeking to(%lu) msec, duration is %d msec\n", position, dur_msec);
But when a rtsp clip (especially from Youtube Desktop View) is paused and kept for sometime,npt-start is still increasing.
This causes problem is position calculation during normal pause resume scenarios also.
Currently during seek , we are sending the current position to rtspsrc module for position saving for later use. */
- if ((MMPLAYER_IS_RTSP_STREAMING( player )) &&
+ if ((MMPLAYER_IS_RTSP_STREAMING(player)) &&
(__mmplayer_get_stream_service_type(player) != STREAMING_SERVICE_LIVE)) {
if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec))
LOGW("getting current position failed in seek\n");
player->last_position = pos_nsec;
- g_object_set( player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "resume-position", player->last_position, NULL );
+ g_object_set(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "resume-position", player->last_position, NULL);
}
if (player->doing_seek) {
if (player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_CALL ||
player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_ALARM ||
- player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA ) {
+ player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA) {
if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
// hold 0.7 second to excute "fadedown mute" effect
LOGW("do fade down->pause->undo fade down");
if (player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_CALL ||
player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_ALARM ||
- player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA ) {
+ player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA) {
if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
//hold 0.7 second to excute "fadedown mute" effect
LOGW("do fade down->pause->undo fade down");
But when a rtsp clip (especially from Youtube Desktop View) is paused and kept for sometime,npt-start is still increasing.
This causes problem is position calculation during normal pause resume scenarios also.
Currently during pause , we are sending the current position to rtspsrc module for position saving. */
- if ((MMPLAYER_IS_RTSP_STREAMING( player )) &&
+ if ((MMPLAYER_IS_RTSP_STREAMING(player)) &&
(__mmplayer_get_stream_service_type(player) != STREAMING_SERVICE_LIVE)) {
- g_object_set( player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "resume-position", player->last_position, NULL );
+ g_object_set(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, "resume-position", player->last_position, NULL);
}
}
break;
char *profileName;
system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
switch (*profileName) {
- case 't':
- case 'T':
- profile_tv = 1;
- break;
- default:
- profile_tv = 0;
+ case 't':
+ case 'T':
+ profile_tv = 1;
+ break;
+ default:
+ profile_tv = 0;
}
free(profileName);
}
/* While adding subtitles in live feeds seek is getting called.
Adding defensive check in framework layer.*/
if (GST_EVENT_TYPE(event) == GST_EVENT_SEEK) {
- if (MMPLAYER_IS_LIVE_STREAMING (player)) {
- LOGE ("Should not send seek event during live playback");
+ if (MMPLAYER_IS_LIVE_STREAMING(player)) {
+ LOGE("Should not send seek event during live playback");
return TRUE;
}
}
}
/* unlink between decoder and videobin and remove previous videosink from videobin */
- GST_ELEMENT_UNLINK(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst));
+ gst_element_unlink(GST_ELEMENT(player->pipeline->mainbin[dec_index].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_BIN].gst));
if (!gst_bin_remove(GST_BIN(player->pipeline->videobin[MMPLAYER_V_BIN].gst), GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst))) {
LOGE("failed to remove former videosink from videobin");
return MM_ERROR_PLAYER_INTERNAL;
LOGE("failed to get sink pad from videobin");
return MM_ERROR_PLAYER_INTERNAL;
}
- if (GST_PAD_LINK_OK != GST_PAD_LINK(src_pad_dec, sink_pad_videobin)) {
+ if (GST_PAD_LINK_OK != gst_pad_link(src_pad_dec, sink_pad_videobin)) {
LOGE("failed to link");
return MM_ERROR_PLAYER_INTERNAL;
}
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player);
- for (i=0; i<MMPLAYER_PATH_MAX; i++) {
+ for (i = 0; i < MMPLAYER_PATH_MAX; i++) {
if (path_type == MMPLAYER_PATH_MAX || path_type == i) {
player->storage_info[i].type = STORAGE_TYPE_INTERNAL;
int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int state)
{
int ret = MM_ERROR_NONE;
- mm_player_t* player = (mm_player_t*) hplayer;
+ mm_player_t* player = (mm_player_t*)hplayer;
MMMessageParamType msg_param = {0, };
MMPLAYER_FENTER();
return ret;
}
- result = g_strdup ("");
+ result = g_strdup("");
for (idx = 0 ; idx < total ; idx++) {
VariantData *v_data = NULL;
v_data = g_list_nth_data(player->adaptive_info.var_list, idx);
if (v_data) {
- gchar data[64]={0};
+ gchar data[64] = {0};
snprintf(data, sizeof(data), "%d,%d,%d,", v_data->bandwidth, v_data->width, v_data->height);
- tmp = g_strconcat (result, data, NULL);
- g_free (result);
+ tmp = g_strconcat(result, data, NULL);
+ g_free(result);
result = tmp;
} else {
LOGW("There is no variant data in %d", idx);
LOGD("set limit to [b]%d, [w]%d, [h]%d", bandwidth, width, height);
- player->adaptive_info.limit.bandwidth = (bandwidth >= ADAPTIVE_VARIANT_DEFAULT_VALUE)?(bandwidth):(ADAPTIVE_VARIANT_DEFAULT_VALUE);
- player->adaptive_info.limit.width = (width >= ADAPTIVE_VARIANT_DEFAULT_VALUE)?(width):(ADAPTIVE_VARIANT_DEFAULT_VALUE);
- player->adaptive_info.limit.height = (height >= ADAPTIVE_VARIANT_DEFAULT_VALUE)?(height):(ADAPTIVE_VARIANT_DEFAULT_VALUE);
+ player->adaptive_info.limit.bandwidth = (bandwidth >= ADAPTIVE_VARIANT_DEFAULT_VALUE) ? (bandwidth) : (ADAPTIVE_VARIANT_DEFAULT_VALUE);
+ player->adaptive_info.limit.width = (width >= ADAPTIVE_VARIANT_DEFAULT_VALUE) ? (width) : (ADAPTIVE_VARIANT_DEFAULT_VALUE);
+ player->adaptive_info.limit.height = (height >= ADAPTIVE_VARIANT_DEFAULT_VALUE) ? (height) : (ADAPTIVE_VARIANT_DEFAULT_VALUE);
if (player->pipeline && player->pipeline->mainbin && player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst) {
LOGD("update max limit of %s", GST_ELEMENT_NAME(player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst));
return MM_ERROR_NONE;
}
-bool util_write_file_backup(const char *backup_path, char *data_ptr, int data_size)
-{
- FILE *fp = NULL;
- int wsize = 0;
-
- fp = fopen(backup_path, "wb");
- if (!fp)
- return FALSE;
-
- wsize = fwrite(data_ptr, sizeof(char), data_size, fp);
-
- fclose(fp);
-
- if (wsize != data_size) {
- if (!access(backup_path, R_OK))
- remove(backup_path);
-
- LOGE("No space to write!\n");
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-bool util_remove_file_backup(const char *backup_path)
-{
- if (!backup_path || !strlen(backup_path))
- return FALSE;
-
- int res = access(backup_path, R_OK);
- if (!res) {
- if (remove(backup_path) == -1)
- return FALSE;
- }
-
- return TRUE;
-}
-
-#define DETECTION_PREFIX_SIZE 20
-int util_is_midi_type_by_mem(void *mem, int size)
-{
- const char *p = (const char *)mem;
-
- if (size < DETECTION_PREFIX_SIZE)
- return MM_AUDIO_CODEC_INVALID;
-
- /* mmf file detection */
- if (p[0] == 'M' && p[1] == 'M' && p[2] == 'M' && p[3] == 'D') {
- LOGD("MM_AUDIO_CODEC_MMF\n");
- return MM_AUDIO_CODEC_MMF;
- }
-
- /* midi file detection */
- if (p[0] == 'M' && p[1] == 'T' && p[2] == 'h' && p[3] == 'd') {
- LOGD("MM_AUDIO_CODEC_MIDI, %d\n", MM_AUDIO_CODEC_MIDI);
- return MM_AUDIO_CODEC_MIDI;
- }
- /* mxmf file detection */
- if (p[0] == 'X' && p[1] == 'M' && p[2] == 'F' && p[3] == '_') {
- LOGD("MM_AUDIO_CODEC_MXMF\n");
- return MM_AUDIO_CODEC_MXMF;
- }
-
- /* wave file detection */
- if (p[0] == 'R' && p[1] == 'I' && p[2] == 'F' && p[3] == 'F' &&
- p[8] == 'W' && p[9] == 'A' && p[10] == 'V' && p[11] == 'E' &&
- p[12] == 'f' && p[13] == 'm' && p[14] == 't') {
- LOGD("MM_AUDIO_CODEC_WAVE\n");
- return MM_AUDIO_CODEC_WAVE;
- }
- /* i-melody file detection */
- if (memcmp(p, "BEGIN:IMELODY", 13) == 0) {
- LOGD("MM_AUDIO_CODEC_IMELODY\n");
- return MM_AUDIO_CODEC_IMELODY;
- }
-
- return MM_AUDIO_CODEC_INVALID;
-}
-
-int util_is_midi_type_by_file(const char *file_path)
-{
- struct stat file_attrib;
- FILE *fp = NULL;
- char prefix[DETECTION_PREFIX_SIZE] = {0,};
- int size;
-
- if (!file_path)
- return FALSE;
-
- fp = fopen(file_path, "r");
-
- if (!fp)
- return FALSE;
-
- memset(&file_attrib, 0, sizeof(file_attrib));
-
- if (stat(file_path, &file_attrib) != 0) {
- fclose(fp);
- return FALSE;
- }
-
- size = (int) file_attrib.st_size;
-
- if (size < DETECTION_PREFIX_SIZE) {
- fclose(fp);
- return FALSE;
- }
-
- size = fread(prefix, sizeof(char), DETECTION_PREFIX_SIZE, fp);
-
- fclose(fp);
-
- return util_is_midi_type_by_mem(prefix, size);
-}
-
char**
util_get_cookie_list(const char *cookies)
{
return ret;
}
-int64_t
-util_get_time(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-int
-util_get_rank_increase(const char *factory_class)
-{
- gint rank_pri_inc = 20;
- gint rank_sec_inc = 10;
- gint ret = 0;
-
- if (g_strrstr(factory_class, "Dsp"))
- ret = rank_pri_inc;
- else if (g_strrstr(factory_class, "HW"))
- ret = rank_pri_inc;
- else if (g_strrstr(factory_class, "Arm"))
- ret = rank_sec_inc;
-
- return ret;
-}
-
-int
-util_factory_rank_compare(GstPluginFeature *f1, GstPluginFeature *f2)
-{
- const gchar *klass;
- int f1_rank_inc = 0, f2_rank_inc = 0;
-
- klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(f1));
- f1_rank_inc = util_get_rank_increase(klass);
-
- klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(f2));
- f2_rank_inc = util_get_rank_increase(klass);
-
- return (gst_plugin_feature_get_rank(f2)+f2_rank_inc) - (gst_plugin_feature_get_rank(f1)+f1_rank_inc);
-}
-
const char*
util_get_charset(const char *file_path)
{