From: Eunhae Choi Date: Wed, 25 May 2016 06:40:01 +0000 (+0900) Subject: [MPR-182] support video gapless playback X-Git-Tag: submit/tizen/20160603.021103^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e511cb1950664baaca43054eb00318bb503e4d8;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git [MPR-182] support video gapless playback Change-Id: I48b126cea5d1ce08bb684a3864871e6ad76fbb2b --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index ccef186..24885ad 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -49,12 +49,17 @@ Multimedia Framework Player Library files (DEV). cp %{SOURCE1001} . %build +export CFLAGS+=" -Wall -DTIZEN_DEBUG -D_FILE_OFFSET_BITS=64 -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" " %if %{with x} -CFLAGS+=" -Wall -DTIZEN_DEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_X11 -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS +export CFLAGS+=" -DHAVE_X11" %endif %if %{with wayland} -CFLAGS+=" -Wall -DTIZEN_DEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_WAYLAND -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS +export CFLAGS+=" -DHAVE_WAYLAND" %endif +%if "%{?profile}" == "tv" +export CFLAGS+=" -DTIZEN_TV" +%endif + LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--hash-style=both -Wl,--as-needed"; export LDFLAGS ./autogen.sh # always enable sdk build. This option should go away diff --git a/src/include/mm_player.h b/src/include/mm_player.h index e94e6c8..9f2428d 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -659,6 +659,13 @@ */ #define MM_PLAYER_DRC_MODE "drc_mode" +/** + * MM_PLAYER_GAPLESS + * + * gapless playback mode (int) + */ +#define MM_PLAYER_GAPLESS_MODE "gapless_mode" + #define BUFFER_MAX_PLANE_NUM (4) typedef struct { diff --git a/src/mm_player_attrs.c b/src/mm_player_attrs.c index c5c94fc..7e7d355 100644 --- a/src/mm_player_attrs.c +++ b/src/mm_player_attrs.c @@ -1096,6 +1096,15 @@ _mmplayer_construct_attribute(MMHandleType handle) MM_ATTRS_VALID_TYPE_INT_RANGE, FALSE, TRUE + }, + { + "gapless_mode", + MM_ATTRS_TYPE_INT, + MM_ATTRS_FLAG_RW, + (void *) FALSE, + MM_ATTRS_VALID_TYPE_INT_RANGE, + FALSE, + TRUE } }; diff --git a/src/mm_player_es.c b/src/mm_player_es.c index 17b2050..7545df5 100644 --- a/src/mm_player_es.c +++ b/src/mm_player_es.c @@ -837,14 +837,14 @@ _mmplayer_set_media_stream_dynamic_resolution(MMHandleType hplayer, bool drc) MMPLAYER_FENTER (); - MMPLAYER_RETURN_VAL_IF_FAIL (player, FALSE); + MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED); mm_attrs_set_int_by_name (player->attrs, MM_PLAYER_DRC_MODE, (int)drc); if (player->v_stream_caps) { - LOGD("update video caps with drc information."); gst_caps_set_simple (player->v_stream_caps, "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL); + MMPLAYER_LOG_GST_CAPS_TYPE (player->v_stream_caps); } MMPLAYER_FLEAVE (); diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 89bbe2e..0eaf5dc 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -5559,7 +5559,25 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl /* support shard memory with S/W codec on HawkP */ if(strncmp(videosink_element, "waylandsink", strlen(videosink_element)) == 0) { - g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "use-tbm", use_tbm, NULL); + g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, + "use-tbm", use_tbm, NULL); + + if (attrs) { + gboolean use_gapless = FALSE; + int count = 0; + int gapless = 0; + + mm_attrs_get_int_by_name (attrs, "profile_play_count", &count); + mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless); + + if (count == -1 || count > 1 || gapless == 1) /* enable gapless when looping */ + use_gapless = TRUE; + + if (g_object_class_find_property (G_OBJECT_GET_CLASS (player->pipeline->videobin[MMPLAYER_V_SINK].gst), "use-gapless")) { + LOGD("set gapless mode at videosink to %d", use_gapless); + g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "use-gapless", use_gapless, NULL); + } + } } } break; @@ -5633,8 +5651,10 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl } gst_object_unref(pad); +#ifndef TIZEN_TV player->gapless.video_data_probe_id = gst_pad_add_probe(player->ghost_pad_for_videobin, GST_PAD_PROBE_TYPE_BUFFER, __mmplayer_gapless_sinkbin_data_probe, player, NULL); +#endif /* done. free allocated variables */ g_list_free(element_bucket); @@ -11682,6 +11702,7 @@ __mmplayer_verify_next_play_path(mm_player_t *player) char *uri = NULL; gint mode = MM_PLAYER_PD_MODE_NONE; gint count = 0; + gint gapless = 0; guint num_of_list = 0; MMPLAYER_FENTER(); @@ -11701,6 +11722,16 @@ __mmplayer_verify_next_play_path(mm_player_t *player) goto ERROR; } +#ifdef TIZEN_TV + /* gapless playback is not supported in case of video at TV profile. */ + mm_attrs_get_int_by_name(attrs, "content_video_found", &mode); + if (mode) + { + LOGW("not support video gapless playback"); + goto ERROR; + } +#endif + if (mm_attrs_get_int_by_name (attrs, "pd_mode", &mode) == MM_ERROR_NONE) { if (mode == TRUE) @@ -11715,6 +11746,20 @@ __mmplayer_verify_next_play_path(mm_player_t *player) LOGE("can not get play count\n"); } + if (mm_attrs_get_int_by_name(attrs, "gapless_mode", &gapless) != MM_ERROR_NONE) + { + LOGE("can not get gapless mode\n"); + } + + if ((count == -1 || count > 1)) /* enable gapless when looping or repeat */ + gapless = 1; + + if (!gapless) + { + LOGW("gapless is disabled\n"); /* FIXME: playlist(without gapless) is not implemented. */ + goto ERROR; + } + num_of_list = g_list_length(player->uri_info.uri_list); LOGD("repeat count = %d, num_of_list = %d\n", count, num_of_list); @@ -11811,7 +11856,6 @@ __mmplayer_verify_next_play_path(mm_player_t *player) player->uri_info.uri_idx = uri_idx; mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri); - if (mmf_attrs_commit(player->attrs)) { LOGE("failed to commit.\n"); @@ -12331,12 +12375,13 @@ int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_ } else { + MMHandleType attrs = 0; + attrs = MMPLAYER_GET_ATTRS(player); + if (num_of_list == 0) { - MMHandleType attrs = 0; char *original_uri = NULL; - attrs = MMPLAYER_GET_ATTRS(player); if ( attrs ) { mm_attrs_get_string_by_name(attrs, "profile_uri", &original_uri); @@ -12356,6 +12401,20 @@ int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_ player->uri_info.uri_list = g_list_append(player->uri_info.uri_list, g_strdup(uri)); LOGD("add new path : %s (total num of list = %d)", uri, g_list_length(player->uri_info.uri_list)); + + if (player->pipeline && player->pipeline->videobin && + player->pipeline->videobin[MMPLAYER_V_SINK].gst && + g_object_class_find_property (G_OBJECT_GET_CLASS (player->pipeline->videobin[MMPLAYER_V_SINK].gst), "use-gapless")) + { + int gapless = 0; + + if (attrs) { + mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless); + } + + LOGD("set gapless mode to %d", gapless); + g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "use-gapless", (gboolean)gapless, NULL); + } } MMPLAYER_FLEAVE();