} MMPlayerUriList;
typedef struct {
+ bool is_set;
+ double scale_x;
+ double scale_y;
+ double scale_width;
+ double scale_height;
+} MMPlayerVideoROI;
+
+typedef struct {
gint active_pad_index;
gint total_track_num;
GPtrArray *channels;
int video360_horizontal_fov;
int video360_vertical_fov;
+ /* Video ROI area scale value */
+ MMPlayerVideoROI video_roi;
} mm_player_t;
typedef struct {
int _mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
int _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled);
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);
/* internal */
void __mmplayer_bus_msg_thread_destroy(MMHandleType hplayer);
return result;
}
+
+int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double scale_y, double scale_width, double scale_height)
+{
+ int result = MM_ERROR_NONE;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ MMPLAYER_CMD_LOCK(player);
+
+ result = _mmplayer_set_video_roi_area(player, scale_x, scale_y, scale_width, scale_height);
+
+ MMPLAYER_CMD_UNLOCK(player);
+
+ return result;
+}
+
+int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height)
+{
+ int result = MM_ERROR_NONE;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ MMPLAYER_CMD_LOCK(player);
+
+ result = _mmplayer_get_video_roi_area(player, scale_x, scale_y, scale_width, scale_height);
+
+ MMPLAYER_CMD_UNLOCK(player);
+
+ return result;
+}
g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "display-geometry-method", display_method, NULL);
LOGD("set video param : method %d", display_method);
}
+void
+__mmplayer_video_param_set_video_roi_area(mm_player_t* player)
+{
+ MMHandleType attrs = 0;
+ 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))
+ return;
+
+ attrs = MMPLAYER_GET_ATTRS(player);
+ MMPLAYER_RETURN_IF_FAIL(attrs);
+ mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
+ if (handle) {
+ gst_video_overlay_set_video_roi_area(
+ GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
+ player->video_roi.scale_x, player->video_roi.scale_y, player->video_roi.scale_width, player->video_roi.scale_height);
+ LOGD("set video param : video roi area scale value: x(%f) y(%f) width(%f) height(%f)",
+ player->video_roi.scale_x, player->video_roi.scale_y, player->video_roi.scale_width, player->video_roi.scale_height);
+ }
+}
void
__mmplayer_video_param_set_roi_area(mm_player_t* player)
__mmplayer_video_param_set_display_rotation(player);
if (update_all_param || !g_strcmp0(param_name, "display_win_roi_x"))
__mmplayer_video_param_set_roi_area(player);
+ if (update_all_param)
+ __mmplayer_video_param_set_video_roi_area(player);
return MM_ERROR_NONE;
}
return MM_ERROR_NONE;
}
+
+int
+_mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_y, double scale_width, double scale_height)
+{
+ mm_player_t* player = (mm_player_t*) hplayer;
+ MMHandleType attrs = 0;
+ void *handle = NULL;
+ int ret = MM_ERROR_NONE;
+
+ MMPLAYER_FENTER();
+
+ 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;
+ }
+
+ player->video_roi.scale_x = scale_x;
+ player->video_roi.scale_y = scale_y;
+ 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);
+
+ if (player->video_roi.is_set) {
+ 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);
+ }
+
+ return ret;
+}
+
+int
+_mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scale_y, double *scale_width, double *scale_height)
+{
+ mm_player_t* player = (mm_player_t*) hplayer;
+ int ret = MM_ERROR_NONE;
+
+ MMPLAYER_FENTER();
+
+ 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;
+
+ 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;
+ }
+
+ return ret;
+}