From dcd686e7bfcb5065ff86fc156af63eb1a174c95c Mon Sep 17 00:00:00 2001 From: Hyunil Date: Wed, 12 May 2021 17:08:56 +0900 Subject: [PATCH] [0.6.256] Apply video rendering for MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI type - Add MMPLAYER_ATTR_DISPLAY_EXPORTED_SHELL_HANDLE attribute - Add setting exported-shell-handle to videosink - Modify video rendering condition Change-Id: Iad35f88aaf2db419802c144968461287512d62b4 Signed-off-by: Hyunil --- packaging/libmm-player.spec | 2 +- src/include/mm_player_attrs.h | 9 ++++---- src/mm_player_attrs.c | 14 ++++++++++-- src/mm_player_priv.c | 52 ++++++++++++++++++++++++++++++++++++++----- 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 7322b58..65bce65 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.255 +Version: 0.6.256 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_player_attrs.h b/src/include/mm_player_attrs.h index 15e64e4..d3a14dd 100644 --- a/src/include/mm_player_attrs.h +++ b/src/include/mm_player_attrs.h @@ -71,14 +71,15 @@ typedef enum { MMPLAYER_ATTRS_DISPLAY_WIN_ROI_WIDTH, /* 40 */ MMPLAYER_ATTRS_DISPLAY_WIN_ROI_HEIGHT, MMPLAYER_ATTRS_DISPLAY_SURFACE_TYPE, + MMPLAYER_ATTRS_DISPLAY_EXPORTED_SHELL_HANDLE, MMPLAYER_ATTRS_SOUND_STREAM_TYPE, MMPLAYER_ATTRS_SOUND_STREAM_INDEX, MMPLAYER_ATTRS_SOUND_LATENCY_MODE, MMPLAYER_ATTRS_PCM_EXTRACTION_SAMPLERATE, MMPLAYER_ATTRS_PCM_EXTRACTION_CHANNELS, MMPLAYER_ATTRS_ACCURATE_SEEK, - MMPLAYER_ATTRS_PCM_EXTRACTION_FORMAT, - MMPLAYER_ATTRS_DRC_MODE, /* 50 */ + MMPLAYER_ATTRS_PCM_EXTRACTION_FORMAT, /* 50 */ + MMPLAYER_ATTRS_DRC_MODE, MMPLAYER_ATTRS_GAPLESS_MODE, MMPLAYER_ATTRS_ENABLE_VIDEO_DECODED_CB, MMPLAYER_ATTRS_VIDEO_CODEC_TYPE, @@ -87,8 +88,8 @@ typedef enum { MMPLAYER_ATTRS_VIDEO_BUFFER_EXTRA_SIZE, MMPLAYER_ATTRS_PREBUFFER_MS, MMPLAYER_ATTRS_REBUFFER_MS, - MMPLAYER_ATTRS_PITCH_CONTROL, - MMPLAYER_ATTRS_PITCH_VALUE, /* 60 */ + MMPLAYER_ATTRS_PITCH_CONTROL, /* 60 */ + MMPLAYER_ATTRS_PITCH_VALUE, MMPLAYER_ATTRS_AUDIO_OFFLOAD, MMPLAYER_ATTRS_AUDIO_OFFLOAD_FORMAT, MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT, diff --git a/src/mm_player_attrs.c b/src/mm_player_attrs.c index 3e83de5..0cc0e04 100644 --- a/src/mm_player_attrs.c +++ b/src/mm_player_attrs.c @@ -360,8 +360,7 @@ int __mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name) player = MM_PLAYER_CAST(handle); - /* apply display attr value to player handle */ - if (!g_strrstr(attribute_name, "display")) + 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)) { @@ -948,6 +947,17 @@ MMHandleType _mmplayer_construct_attribute(MMHandleType handle) NULL, }, { + MMPLAYER_ATTRS_DISPLAY_EXPORTED_SHELL_HANDLE, + (char *)"exported_shell_handle", + MM_ATTRS_TYPE_STRING, + MM_ATTRS_FLAG_RW, + {(void *)NULL}, + MM_ATTRS_VALID_TYPE_NONE, + {0}, + {0}, + NULL, + }, + { MMPLAYER_ATTRS_SOUND_STREAM_TYPE, (char *)"sound_stream_type", MM_ATTRS_TYPE_STRING, diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index c838ff1..73046be 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -1765,7 +1765,7 @@ __mmplayer_gst_create_sink_bin(GstElement *elem, GstPad *pad, GstCaps *ref_caps, mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type); LOGD("display_surface_type (%d)", surface_type); - if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY) && + if ((surface_type == MM_DISPLAY_SURFACE_OVERLAY || surface_type == MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI) && (_mmplayer_acquire_hw_resource(player, MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY) != MM_ERROR_NONE)) { LOGE("failed to acquire video overlay resource"); goto ERROR; @@ -1982,7 +1982,8 @@ static void __mmplayer_video_param_set_display_visible(mmplayer_t *player) MMPLAYER_FENTER(); /* check video sinkbin is created */ - if (!_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_OVERLAY)) + if (!(_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_OVERLAY) || + _mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI))) return; attrs = MMPLAYER_GET_ATTRS(player); @@ -2070,6 +2071,25 @@ static void __mmplayer_video_param_set_roi_area(mmplayer_t *player) win_roi_x, win_roi_y, win_roi_width, win_roi_height); } +static void __mmplayer_video_param_set_display_overlay_sync_ui(mmplayer_t *player) +{ + MMHandleType attrs = 0; + gchar *handle = NULL; + + /* check video sinkbin is created */ + if (!_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI)) + return; + + attrs = MMPLAYER_GET_ATTRS(player); + MMPLAYER_RETURN_IF_FAIL(attrs); + + /* common case if using overlay surface */ + mm_attrs_get_string_by_name(attrs, "exported_shell_handle", &handle); + MMPLAYER_RETURN_IF_FAIL(handle); + g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "exported-shell-handle", handle, NULL); + LOGD("set video param: exported_shell_handle (%s)", handle); +} + static void __mmplayer_video_param_set_display_overlay(mmplayer_t *player) { MMHandleType attrs = 0; @@ -2097,10 +2117,20 @@ int _mmplayer_update_video_overlay_param(mmplayer_t *player, const char *param_name) { gboolean update_all_param = FALSE; + int curr_type = MM_DISPLAY_SURFACE_NUM; MMPLAYER_FENTER(); - if (!_mmplayer_is_videosink_ready(player, MM_DISPLAY_SURFACE_OVERLAY)) { + mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &curr_type); + + if (curr_type != MM_DISPLAY_SURFACE_OVERLAY && curr_type != MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI) { + LOGE("current type(%d) is wrong", curr_type); + return MM_ERROR_PLAYER_INTERNAL; + } + + if (!player || !player->pipeline || !player->pipeline->mainbin || !player->pipeline->videobin || + !player->pipeline->videobin[MMPLAYER_V_BIN].gst || + !player->pipeline->videobin[MMPLAYER_V_SINK].gst) { LOGW("videosink is not ready yet"); return MM_ERROR_PLAYER_NOT_INITIALIZED; } @@ -2114,6 +2144,11 @@ _mmplayer_update_video_overlay_param(mmplayer_t *player, const char *param_name) if (!g_strcmp0(param_name, "update_all_param")) update_all_param = TRUE; + if (curr_type == MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI) { + __mmplayer_video_param_set_display_overlay_sync_ui(player); + MMPLAYER_FLEAVE(); + return MM_ERROR_NONE; + } if (update_all_param || !g_strcmp0(param_name, "display_overlay")) __mmplayer_video_param_set_display_overlay(player); if (update_all_param || !g_strcmp0(param_name, "display_method")) @@ -2127,7 +2162,6 @@ _mmplayer_update_video_overlay_param(mmplayer_t *player, const char *param_name) if (update_all_param) __mmplayer_video_param_set_video_roi_area(player); - MMPLAYER_FLEAVE(); return MM_ERROR_NONE; } @@ -2171,6 +2205,7 @@ static int __mmplayer_set_disable_overlay_option(mmplayer_t *player, bool disabl LOGD("enable overlay"); __mmplayer_video_param_set_display_overlay(player); + __mmplayer_video_param_set_display_overlay_sync_ui(player); g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "disable-overlay", FALSE, NULL); } @@ -3524,7 +3559,9 @@ __mmplayer_gst_create_video_filters(mmplayer_t *player, MMDisplaySurfaceType sur goto EXIT; } - if (surface_type != MM_DISPLAY_SURFACE_OVERLAY || player->set_mode.video_zc) { + if ((surface_type != MM_DISPLAY_SURFACE_OVERLAY && + surface_type != MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI) || + player->set_mode.video_zc) { LOGD("skip creating the videoconv and rotator"); return MM_ERROR_NONE; } @@ -3554,10 +3591,13 @@ __mmplayer_get_videosink_factory_name(mmplayer_t *player, MMDisplaySurfaceType s switch (surface_type) { case MM_DISPLAY_SURFACE_OVERLAY: + /* fall through */ + case MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI: if (strlen(player->ini.videosink_element_overlay) > 0) factory_name = player->ini.videosink_element_overlay; break; case MM_DISPLAY_SURFACE_REMOTE: + /* fall through */ case MM_DISPLAY_SURFACE_NULL: if (strlen(player->ini.videosink_element_fake) > 0) factory_name = player->ini.videosink_element_fake; @@ -3591,7 +3631,7 @@ __mmplayer_gst_set_videosink_property(mmplayer_t *player, MMDisplaySurfaceType s return MM_ERROR_PLAYER_INTERNAL; } - if (surface_type == MM_DISPLAY_SURFACE_OVERLAY) { + if (surface_type == MM_DISPLAY_SURFACE_OVERLAY || surface_type == MM_DISPLAY_SURFACE_OVERLAY_SYNC_UI) { bool use_tbm = (player->set_mode.video_zc || (player->is_360_feature_enabled && player->is_content_spherical)); if (strncmp(factory_name, "tizenwlsink", strlen(factory_name)) == 0) { g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, -- 2.7.4