- It's for switching device command support.
[Version] 1.4.0
[Issue Type] New feature
Change-Id: Ifaa3ffd1981e121d696e9ae7b6145eeadd5ee1ae
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
Name: libmm-camcorder
Summary: Camera and recorder library
-Version: 1.3.4
+Version: 1.4.0
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
*/
#define MMCAM_VIDEO_STREAM_CALLBACK_FLAG "video-stream-callback-flag"
+/**
+ * Switch device
+ */
+#define MMCAM_CAMERA_SWITCH_DEVICE "camera-switch-device"
+
/*=======================================================================================
MM_CAM_REQUEST_CODEC_CONFIG,
MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_INTERNAL_CB,
MM_CAM_VIDEO_STREAM_CALLBACK_FLAG,
- MM_CAM_FILTER_WB_TEMPERATURE, /* 145 */
+ MM_CAM_CAMERA_SWITCH_DEVICE, /* 145 */
+ MM_CAM_FILTER_WB_TEMPERATURE,
MM_CAM_FILTER_WB_TEMPERATURE_STEP,
MM_CAM_CAMERA_GAIN,
MM_CAM_CAMERA_GAIN_STEP,
bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
bool _mmcamcorder_commit_extra_preview(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
bool _mmcamcorder_commit_request_codec_config(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
+bool _mmcamcorder_commit_camera_switch_device(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
/**
#define _MMCAMCORDER_SENSOR_ENUM_NONE -255
/* camera information related */
-#define CAMINFO_CONVERT_NUM 49
+#define CAMINFO_CONVERT_NUM 50
/*=======================================================================================
{.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
+ {
+ MM_CAM_CAMERA_SWITCH_DEVICE,
+ "camera-switch-device",
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_switch_device,
+ },
{
MM_CAM_FILTER_WB_TEMPERATURE,
"filter-wb-temperature",
}
+bool _mmcamcorder_commit_camera_switch_device(MMHandleType handle, int attr_idx, const MMAttrsValue *value)
+{
+ int device = 0;
+ int current_state = MM_CAMCORDER_STATE_NONE;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = NULL;
+ GstCameraControl *control = NULL;
+
+ mmf_return_val_if_fail(hcamcorder && value, FALSE);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, TRUE);
+
+ current_state = _mmcamcorder_get_state(handle);
+
+ if (hcamcorder->type != MM_CAMCORDER_MODE_VIDEO_CAPTURE ||
+ current_state != MM_CAMCORDER_STATE_PREPARE ||
+ !GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ MMCAM_LOG_ERROR("invalid condition[type:%d,state:%d]",
+ hcamcorder->type, current_state);
+ return FALSE;
+ }
+
+ device = value->value.i_val;
+
+ MMCAM_LOG_INFO("switch device[%d]", device);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_switch_device(control, device)) {
+ MMCAM_LOG_ERROR("switch device[%d] failed", device);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
{ "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
{ "MeasurePreviewFPS", CONFIGURE_VALUE_INT, {.value_int = 0} },
{ "DefaultEncodedPreviewBitrate", CONFIGURE_VALUE_INT, {.value_int = DEFAULT_ENCODED_PREVIEW_BITRATE} },
+ { "SwitchDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
{ "UpdateCapsByStreamRotation", CONFIGURE_VALUE_INT, {.value_int = 0} },
};
MM_CAMCONVERT_TYPE_INT_RANGE,
NULL,
},
+ {
+ CONFIGURE_TYPE_MAIN,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ MM_CAM_CAMERA_SWITCH_DEVICE,
+ MM_CAMCORDER_ATTR_NONE,
+ "SwitchDevice",
+ MM_CAMCONVERT_TYPE_INT_ARRAY,
+ NULL,
+ },
{
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_EFFECT,