[0.6.130] modify setting video roi function 84/188384/1 accepted/tizen/unified/20180905.060830 submit/tizen/20180904.110532
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 4 Sep 2018 10:18:55 +0000 (19:18 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 4 Sep 2018 10:18:55 +0000 (19:18 +0900)
Change-Id: Ibf984d16ded32a6559a5b05e6cbca3603013d70d

packaging/libmm-player.spec
src/include/mm_player_priv.h
src/mm_player_priv.c

index 5cd44e7..a2d60ba 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.129
+Version:    0.6.130
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index bd017c6..da43974 100644 (file)
@@ -466,7 +466,6 @@ typedef struct {
 } MMPlayerUriList;
 
 typedef struct {
-       bool is_set;
        double scale_x;
        double scale_y;
        double scale_width;
index f9c85c1..f8cf0b9 100644 (file)
@@ -2527,14 +2527,11 @@ __mmplayer_video_param_set_video_roi_area(mm_player_t* player)
        void *handle = NULL;
        MMPLAYER_FENTER();
 
-       if (!player->video_roi.is_set) {
-               LOGE("Video content ROI is not set");
-               return;
-       }
-
        /* check video sinkbin is created */
-       if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+       if (__mmplayer_video_param_check_video_sink_bin(player) != MM_ERROR_NONE) {
+               LOGW("There is no video sink");
                return;
+       }
 
        attrs = MMPLAYER_GET_ATTRS(player);
        MMPLAYER_RETURN_IF_FAIL(attrs);
@@ -2561,8 +2558,10 @@ __mmplayer_video_param_set_roi_area(mm_player_t* player)
        MMPLAYER_FENTER();
 
        /* check video sinkbin is created */
-       if (MM_ERROR_NONE != __mmplayer_video_param_check_video_sink_bin(player))
+       if (__mmplayer_video_param_check_video_sink_bin(player) != MM_ERROR_NONE) {
+               LOGW("There is no video sink");
                return;
+       }
 
        attrs = MMPLAYER_GET_ATTRS(player);
        MMPLAYER_RETURN_IF_FAIL(attrs);
@@ -2582,7 +2581,6 @@ __mmplayer_video_param_set_roi_area(mm_player_t* player)
                         win_roi_x, win_roi_y, win_roi_width, win_roi_height);
                LOGD("set video param : roi area : x(%d) y(%d) width(%d) height(%d)",
                        win_roi_x, win_roi_y, win_roi_width, win_roi_height);
-
        }
 }
 void
@@ -5382,6 +5380,15 @@ __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res,
        return FALSE;
 }
 
+static void
+__mmplayer_initialize_video_roi(mm_player_t *player)
+{
+       player->video_roi.scale_x = 0.0;
+       player->video_roi.scale_y = 0.0;
+       player->video_roi.scale_width = 1.0;
+       player->video_roi.scale_height = 1.0;
+}
+
 int
 _mmplayer_create_player(MMHandleType handle)
 {
@@ -5525,6 +5532,8 @@ _mmplayer_create_player(MMHandleType handle)
        player->video360_horizontal_fov = PLAYER_SPHERICAL_DEFAULT_H_FOV;
        player->video360_vertical_fov = PLAYER_SPHERICAL_DEFAULT_V_FOV;
 
+       __mmplayer_initialize_video_roi(player);
+
        /* set player state to null */
        MMPLAYER_STATE_CHANGE_TIMEOUT(player) = player->ini.localplayback_state_change_timeout;
        MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_NULL);
@@ -8518,6 +8527,7 @@ __mmplayer_release_misc(mm_player_t* player)
 
        player->sound.rg_enable = false;
 
+       __mmplayer_initialize_video_roi(player);
        MMPLAYER_FLEAVE();
 }
 
@@ -10370,15 +10380,10 @@ _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       /* check video sinkbin is created */
-       if (ret != __mmplayer_video_param_check_video_sink_bin(player))
-               return ret;
-
        attrs = MMPLAYER_GET_ATTRS(player);
        MMPLAYER_RETURN_VAL_IF_FAIL(attrs, MM_ERROR_PLAYER_INTERNAL);
 
        mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
-
        if (!handle) {
                LOGE("Display handle is NULL, after setting window handle, set video roi area");
                return MM_ERROR_PLAYER_INTERNAL;
@@ -10389,14 +10394,19 @@ _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_
        player->video_roi.scale_width = scale_width;
        player->video_roi.scale_height = scale_height;
 
-       player->video_roi.is_set = gst_video_overlay_set_video_roi_area(
-                        GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
-                        scale_x, scale_y, scale_width, scale_height);
+       /* check video sinkbin is created */
+       if (__mmplayer_video_param_check_video_sink_bin(player) != MM_ERROR_NONE)
+               return MM_ERROR_NONE;
 
-       if (player->video_roi.is_set) {
+       if (!gst_video_overlay_set_video_roi_area(
+               GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+               scale_x, scale_y, scale_width, scale_height))
+               ret = MM_ERROR_PLAYER_INTERNAL;
+       else
                LOGD("set video param : video roi area scale value: x(%f) y(%f) width(%f) height(%f)",
                        scale_x, scale_y, scale_width, scale_height);
-       }
+
+       MMPLAYER_FLEAVE();
 
        return ret;
 }
@@ -10412,22 +10422,13 @@ _mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scal
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        MMPLAYER_RETURN_VAL_IF_FAIL(scale_x && scale_y && scale_width && scale_height, MM_ERROR_INVALID_ARGUMENT);
 
-       /* check video sinkbin is created */
-       if (ret != __mmplayer_video_param_check_video_sink_bin(player))
-               return ret;
+       *scale_x = player->video_roi.scale_x;
+       *scale_y = player->video_roi.scale_y;
+       *scale_width = player->video_roi.scale_width;
+       *scale_height = player->video_roi.scale_height;
 
-       if (player->video_roi.is_set) {
-               *scale_x = player->video_roi.scale_x;
-               *scale_y = player->video_roi.scale_y;
-               *scale_width = player->video_roi.scale_width;
-               *scale_height = player->video_roi.scale_height;
-       } else {
-               LOGE("Video content ROI is not set");
-               *scale_x = 0.0;
-               *scale_y = 0.0;
-               *scale_width = 1.0;
-               *scale_height = 1.0;
-       }
+       LOGD("get video param : video roi area scale value: x(%f) y(%f) width(%f) height(%f)",
+               *scale_x, *scale_y, *scale_width, *scale_height);
 
        return ret;
 }