},
//110
{
+ MM_CAM_CAMERA_PAN_MECHA,
+ "camera-pan-mecha",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = -1},
+ _mmcamcorder_commit_camera_pan,
+ },
+ {
+ MM_CAM_CAMERA_PAN_ELEC,
+ "camera-pan-elec",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = -1},
+ _mmcamcorder_commit_camera_pan,
+ },
+ {
+ MM_CAM_CAMERA_TILT_MECHA,
+ "camera-tilt-mecha",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = -1},
+ _mmcamcorder_commit_camera_tilt,
+ },
+ {
+ MM_CAM_CAMERA_TILT_ELEC,
+ "camera-tilt-elec",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = -1},
+ _mmcamcorder_commit_camera_tilt,
+ },
+ {
+ MM_CAM_CAMERA_PTZ_TYPE,
+ "camera-ptz-type",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_ptz_type,
+ },
+ {
MM_CAM_VIDEO_WIDTH,
"video-width",
MMF_VALUE_TYPE_INT,
{.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_encoded_preview_gop_interval,
},
+ //120
{
MM_CAM_RECORDER_TAG_ENABLE,
"recorder-tag-enable",
{.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_pid_for_sound_focus,
},
- //120
{
MM_CAM_ROOT_DIRECTORY,
"root-directory",
{0},
{0},
NULL,
+ },
+ {
+ MM_CAM_SOUND_STREAM_TYPE,
+ "sound-stream-type",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_SOUND_STREAM_INDEX,
+ "sound-stream-index",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)-1},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = -1},
+ {.int_max = _MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_sound_stream_info,
}
};
_mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+ /* check decoder recreation */
+ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
+ _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
+ g_mutex_unlock(&hcamcorder->restart_preview_lock);
+ return FALSE;
+ }
+
/* get preview format */
sc->info_image->preview_format = preview_format;
sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
_mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+ /* check decoder recreation */
+ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
+ _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
+ g_mutex_unlock(&hcamcorder->restart_preview_lock);
+ return FALSE;
+ }
+
/* get preview format */
sc->info_image->preview_format = preview_format;
sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
}
+bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ _MMCamcorderSubContext *sc = NULL;
+ int current_state = MM_CAMCORDER_STATE_NONE;
+
+ GstCameraControl *CameraControl = NULL;
+ GstCameraControlChannel *CameraControlChannel = NULL;
+ const GList *controls = NULL;
+ const GList *item = NULL;
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, TRUE);
+
+ _mmcam_dbg_log("ptz type : %d", value->value.i_val);
+
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state < MM_CAMCORDER_STATE_PREPARE ||
+ current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_err("invalid state[%d]", current_state);
+ return FALSE;
+ }
+
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ _mmcam_dbg_log("Can't cast Video source into camera control.");
+ return FALSE;
+ }
+
+ CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (CameraControl == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
+ controls = gst_camera_control_list_channels(CameraControl);
+ if (controls == NULL) {
+ _mmcam_dbg_err("gst_camera_control_list_channels failed");
+ return FALSE;
+ }
+
+ for (item = controls ; item && item->data ; item = item->next) {
+ CameraControlChannel = item->data;
+ _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+ if (!strcmp(CameraControlChannel->label, "ptz")) {
+ if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) {
+ _mmcam_dbg_warn("set ptz type %d done", value->value.i_val);
+ return TRUE;
+ } else {
+ _mmcam_dbg_err("failed to set ptz type %d", value->value.i_val);
+ return FALSE;
+ }
+ }
+ }
+
+ if (item == NULL) {
+ _mmcam_dbg_warn("failed to find tilt control channel");
+ }
+ }
+
+ return FALSE;
+}
+
+
+bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ _MMCamcorderSubContext *sc = NULL;
+ int current_state = MM_CAMCORDER_STATE_NONE;
+
+ GstCameraControl *CameraControl = NULL;
+ GstCameraControlChannel *CameraControlChannel = NULL;
+ const GList *controls = NULL;
+ const GList *item = NULL;
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, TRUE);
+
+ _mmcam_dbg_log("pan : %d", value->value.i_val);
+
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state < MM_CAMCORDER_STATE_PREPARE ||
+ current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_err("invalid state[%d]", current_state);
+ return FALSE;
+ }
+
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ _mmcam_dbg_log("Can't cast Video source into camera control.");
+ return FALSE;
+ }
+
+ CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (CameraControl == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
+ controls = gst_camera_control_list_channels(CameraControl);
+ if (controls == NULL) {
+ _mmcam_dbg_err("gst_camera_control_list_channels failed");
+ return FALSE;
+ }
+
+ for (item = controls ; item && item->data ; item = item->next) {
+ CameraControlChannel = item->data;
+ _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+ if (!strcmp(CameraControlChannel->label, "pan")) {
+ if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) {
+ _mmcam_dbg_warn("set pan %d done", value->value.i_val);
+ return TRUE;
+ } else {
+ _mmcam_dbg_err("failed to set pan %d", value->value.i_val);
+ return FALSE;
+ }
+ }
+ }
+
+ if (item == NULL) {
+ _mmcam_dbg_warn("failed to find pan control channel");
+ }
+ }
+
+ return FALSE;
+}
+
+
+bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ _MMCamcorderSubContext *sc = NULL;
+ int current_state = MM_CAMCORDER_STATE_NONE;
+
+ GstCameraControl *CameraControl = NULL;
+ GstCameraControlChannel *CameraControlChannel = NULL;
+ const GList *controls = NULL;
+ const GList *item = NULL;
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, TRUE);
+
+ _mmcam_dbg_log("tilt : %d", value->value.i_val);
+
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state < MM_CAMCORDER_STATE_PREPARE ||
+ current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_err("invalid state[%d]", current_state);
+ return FALSE;
+ }
+
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ _mmcam_dbg_log("Can't cast Video source into camera control.");
+ return FALSE;
+ }
+
+ CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (CameraControl == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
+ controls = gst_camera_control_list_channels(CameraControl);
+ if (controls == NULL) {
+ _mmcam_dbg_err("gst_camera_control_list_channels failed");
+ return FALSE;
+ }
+
+ for (item = controls ; item && item->data ; item = item->next) {
+ CameraControlChannel = item->data;
+ _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+ if (!strcmp(CameraControlChannel->label, "tilt")) {
+ if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) {
+ _mmcam_dbg_warn("set tilt %d done", value->value.i_val);
+ return TRUE;
+ } else {
+ _mmcam_dbg_err("failed to set tilt %d", value->value.i_val);
+ return FALSE;
+ }
+ }
+ }
+
+ if (item == NULL) {
+ _mmcam_dbg_warn("failed to find tilt control channel");
+ }
+ }
+
+ return FALSE;
+}
+
+
bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
MMHandleType attr = 0;
#ifdef HAVE_WAYLAND
} else if (!strcmp(videosink_name, "waylandsink")) {
MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)p_handle;
- GstContext *context = NULL;
- context = gst_wayland_display_handle_context_new((struct wl_display *)wl_info->display);
- if (context) {
- gst_element_set_context(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, context);
- } else {
- _mmcam_dbg_warn("gst_wayland_display_handle_context_new failed");
- }
+ _mmcam_dbg_log("wayland global surface id : %d", wl_info->global_surface_id);
- gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->surface);
+ gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->global_surface_id);
gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
- wl_info->window_x,
- wl_info->window_y,
- wl_info->window_width,
- wl_info->window_height);
+ wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
#endif /* HAVE_WAYLAND */
} else {
_mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name);
_mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
- if (!strcmp(videosink_name, "xvimagesink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) {
_mmcam_dbg_log("Commit : display mode [%d]", value->value.i_val);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-mode", value->value.i_val);
return TRUE;
return FALSE;
}
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "evasimagesink") ||
- !strcmp(videosink_name, "evaspixmapsink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+ !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "visible", value->value.i_val);
_mmcam_dbg_log("Set visible [%d] done.", value->value.i_val);
return TRUE;
return FALSE;
}
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "evasimagesink") ||
- !strcmp(videosink_name, "evaspixmapsink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+ !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
method = value->value.i_val;
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
return TRUE;
} else {
_mmcam_dbg_warn("videosink[%s] does not support geometry method.", videosink_name);
{
int current_state = MM_CAMCORDER_STATE_NONE;
int method = 0;
+ int ret = MM_ERROR_NONE;
const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
return FALSE;
}
- if (!strcmp(videosink_name, "xvimagesink") ||
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
int rect_x = 0;
int rect_y = 0;
}
if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
- _mmcam_dbg_log("RECT(x,y,w,h) = (%d,%d,%d,%d)",
- rect_x, rect_y, rect_width, rect_height);
- g_object_set(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
- "dst-roi-x", rect_x,
- "dst-roi-y", rect_y,
- "dst-roi-w", rect_width,
- "dst-roi-h", rect_height,
- NULL);
+ _mmcam_dbg_log("RECT(x,y,w,h) = (%d,%d,%d,%d)", rect_x, rect_y, rect_width, rect_height);
+
+ if (!strcmp(videosink_name, "waylandsink")) {
+ ret = gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
+ rect_x, rect_y, rect_width, rect_height);
+ if (!ret) {
+ _mmcam_dbg_err("FAILED : could not set render rectangle.");
+ return FALSE;
+ }
+ } else {
+ g_object_set(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
+ "dst-roi-x", rect_x,
+ "dst-roi-y", rect_y,
+ "dst-roi-w", rect_width,
+ "dst-roi-h", rect_height,
+ NULL);
+ }
}
return TRUE;
}
zoom = value->value.i_val;
- if (!strcmp(videosink_name, "xvimagesink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) {
vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1));
_mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+ /* check decoder recreation */
+ if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
+ _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
+ return FALSE;
+ }
+
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
}
}
+bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ char *stream_type = NULL;
+ int stream_type_len = 0;
+ _MMCamcorderSubContext *sc = NULL;
+
+ if ((void *)handle == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc || !sc->encode_element ||
+ !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+ _mmcam_dbg_log("audiosrc element is not initialized, it will be set later");
+ return TRUE;
+ }
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_SOUND_STREAM_TYPE, &stream_type, &stream_type_len,
+ NULL);
+
+ if (stream_type == NULL) {
+ _mmcam_dbg_err("stream type is not set");
+ return FALSE;
+ }
+
+ _mmcam_dbg_log("Commit : sound stream info - type %s", stream_type);
+
+ return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, value->value.i_val);
+}
+
+
static bool
__mmcamcorder_attrs_is_supported(MMHandleType handle, int idx)
{