#include <gst/video/colorbalance.h>
#include <gst/video/cameracontrol.h>
#include <gst/video/videooverlay.h>
-#include <gst/wayland/wayland.h>
/*-----------------------------------------------------------------------
| MACRO DEFINITIONS: |
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_VALID_TYPE_INT_RANGE,
{.int_min = -1},
{.int_max = _MMCAMCORDER_MAX_INT},
+ 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},
_mmcamcorder_commit_sound_stream_info,
},
{
{0},
{0},
NULL,
+ },
+ {
+ MM_CAM_GDBUS_CONNECTION,
+ "gdbus-connection",
+ MMF_VALUE_TYPE_DATA,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
}
};
MMHandleType attrs = 0;
int ret = MM_ERROR_NONE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ va_list var_args_copy;
mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
/*mmf_return_val_if_fail(err_attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);*/
return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
}
+ /* copy var_args to keep original var_args */
+ va_copy(var_args_copy, var_args);
+
attrs = MMF_CAMCORDER_ATTRS(handle);
if (attrs) {
ret = __mmcamcorder_check_valid_pair(handle, err_attr_name, attribute_name, var_args);
} else {
- _mmcam_dbg_err("handle 0x%x, attrs is NULL, attr name [%s]", handle, attribute_name);
+ _mmcam_dbg_err("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name);
ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
}
if (ret == MM_ERROR_NONE) {
hcamcorder->error_code = MM_ERROR_NONE;
- ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args);
+ /* In 64bit environment, unexpected result is returned if var_args is used again. */
+ ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args_copy);
}
+ va_end(var_args_copy);
+
_MMCAMCORDER_UNLOCK_CMD(handle);
if (ret != MM_ERROR_NONE) {
const char *videosrc_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
+ _MMCamcorderImageInfo *info = NULL;
GstCameraControl *control = NULL;
type_element *VideosrcElement = NULL;
if (!sc)
return TRUE;
+ info = sc->info_image;
+ if (!info) {
+ _mmcam_dbg_err("info image is NULL");
+ return FALSE;
+ }
+
if (ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ if (info->capture_send_count > 0) {
+ info->capturing = FALSE;
+ _mmcam_dbg_warn("capturing -> FALSE and skip capture callback since now");
+ }
+
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_warn("Can't cast Video source into camera control.");
return TRUE;
}
}
- if (item == NULL) {
- _mmcam_dbg_warn("failed to find tilt control channel");
- }
+ _mmcam_dbg_warn("failed to find tilt control channel");
}
return FALSE;
}
}
- if (item == NULL) {
- _mmcam_dbg_warn("failed to find pan control channel");
- }
+ _mmcam_dbg_warn("failed to find pan control channel");
}
return FALSE;
}
}
- if (item == NULL) {
- _mmcam_dbg_warn("failed to find tilt control channel");
- }
+ _mmcam_dbg_warn("failed to find tilt control channel");
}
return FALSE;
bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
- _MMCamcorderSubContext *sc = NULL;
- const char *filename = NULL;
int size = 0;
+ const char *filename = NULL;
mmf_return_val_if_fail(handle && value, FALSE);
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- if (!sc)
- return TRUE;
-
/* get string */
filename = mmf_value_get_string(value, &size);
if (filename == NULL) {
return FALSE;
}
- if (sc->info_video) {
- SAFE_G_FREE(sc->info_video->filename);
- sc->info_video->filename = g_strdup(filename);
- if (sc->info_video->filename == NULL) {
- _mmcam_dbg_err("failed to strdup filename [%s]", filename);
- return FALSE;
- }
- }
-
- if (sc->encode_element && sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst) {
- _mmcam_dbg_log("new file location set.[%s] filesink %p", filename, sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst);
- MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
- _mmcam_dbg_log("new file location set.(%s)", filename);
- } else {
- _mmcam_dbg_log("element is not created yet. [%s] will be set later...", filename);
- }
+ _mmcam_dbg_log("set filename [%s]", filename);
return TRUE;
}
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;
} else {
- _mmcam_dbg_warn("Commit : This element [%s] does not support display mode", videosink_name);
- return FALSE;
+ _mmcam_dbg_warn("[%s] does not support display mode, but no error", videosink_name);
}
+
+ return TRUE;
}
!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;
} else {
- _mmcam_dbg_warn("videosink[%s] does not support VISIBLE.", videosink_name);
- return FALSE;
+ _mmcam_dbg_warn("[%s] does not support VISIBLE, but no error", videosink_name);
}
+
+ return TRUE;
}
!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);
- return TRUE;
} else {
- _mmcam_dbg_warn("videosink[%s] does not support geometry method.", videosink_name);
- return FALSE;
+ _mmcam_dbg_warn("[%s] does not support geometry method, but no error", videosink_name);
}
+
+ return TRUE;
}
NULL);
}
}
-
- return TRUE;
} else {
- _mmcam_dbg_warn("videosink[%s] does not support display rect.", videosink_name);
- return FALSE;
+ _mmcam_dbg_warn("[%s] does not support display rect, but no error", videosink_name);
}
+
+ return TRUE;
}
new_pid = value->value.i_val;
- _mmcam_dbg_log("Commit : pid %d, current focus id %d, subscribe id %u",
+ _mmcam_dbg_warn("Commit : pid %d, current focus id %d, subscribe id %u",
new_pid, hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id);
/* unregister sound focus and unsubscribe sound signal before set new one */
hcamcorder->sound_focus_register = FALSE;
_mmcam_dbg_warn("no need to use sound focus internally");
} else {
+ /* check my session type : allow only media & call series here */
+ if ((hcamcorder->session_type != MM_SESSION_TYPE_MEDIA) &&
+ (hcamcorder->session_type != MM_SESSION_TYPE_MEDIA_RECORD) &&
+ (hcamcorder->session_type != MM_SESSION_TYPE_CALL) &&
+ (hcamcorder->session_type != MM_SESSION_TYPE_VIDEOCALL) &&
+ (hcamcorder->session_type != MM_SESSION_TYPE_VOIP)) {
+ _mmcam_dbg_err("Blocked by session policy, my session_type[%s]", hcamcorder->session_type);
+ hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
+ return FALSE;
+ }
+
ret = mm_sound_focus_get_id(&hcamcorder->sound_focus_id);
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_err("mm_sound_focus_get_id failed");
bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
+ int stream_index = 0;
char *stream_type = NULL;
- int stream_type_len = 0;
_MMCamcorderSubContext *sc = NULL;
mmf_return_val_if_fail(handle && value, 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;
+ stream_type = value->value.s_val;
+ if (!stream_type) {
+ _mmcam_dbg_err("NULL string");
+ return FALSE;
}
mm_camcorder_get_attributes(handle, NULL,
- MMCAM_SOUND_STREAM_TYPE, &stream_type, &stream_type_len,
+ MMCAM_SOUND_STREAM_INDEX, &stream_index,
NULL);
-
- if (stream_type == NULL) {
- _mmcam_dbg_err("stream type is not set");
+ if (stream_index < 0) {
+ _mmcam_dbg_err("invalid stream index %d", stream_index);
return FALSE;
}
- _mmcam_dbg_log("Commit : sound stream info - type %s", stream_type);
+ /* unset watch callback if existed */
+ _mmcamcorder_sound_signal_callback(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1, (void *)handle);
- return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, value->value.i_val);
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc || !sc->encode_element ||
+ !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+ _mmcam_dbg_warn("audiosrc element is not initialized, it will be set later");
+ return TRUE;
+ }
+
+ _mmcam_dbg_warn("Commit : sound stream info - type %s, index %d", stream_type, stream_index);
+
+ return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index);
}
MM_CAM_CAMERA_WDR,
MM_CAM_FILTER_CONTRAST,
MM_CAM_FILTER_HUE,
- MM_CAM_STROBE_MODE,
MM_CAM_DETECT_MODE
};
mmf_return_val_if_fail(hcamcorder, FALSE);
- _mmcam_dbg_log("Set all attribute again.");
+ _mmcam_dbg_log("commit some attributes again");
attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
if (attr == NULL) {
}
+bool _mmcamcorder_set_attribute_to_camsensor2(MMHandleType handle)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ mmf_attrs_t *attr = NULL;
+
+ unsigned int i = 0;
+ int ret = TRUE;
+ int attr_idxs[] = {
+ MM_CAM_STROBE_MODE
+ };
+
+ mmf_return_val_if_fail(hcamcorder, FALSE);
+
+ _mmcam_dbg_log("commit some attribute again[2]");
+
+ attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
+ if (attr == NULL) {
+ _mmcam_dbg_err("Get attribute handle failed.");
+ return FALSE;
+ } else {
+ _mmcam_dbg_log("attribute count(%d)", attr->count);
+
+ for (i = 0 ; i < ARRAY_SIZE(attr_idxs) ; i++) {
+ if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, attr_idxs[i]))
+ mmf_attribute_set_modified(&(attr->items[attr_idxs[i]]));
+ }
+
+ if (mmf_attrs_commit((MMHandleType)attr) == -1)
+ ret = FALSE;
+ else
+ ret = TRUE;
+ }
+
+ _mmcam_dbg_log("Done.");
+
+ return ret;
+}
+
+
int _mmcamcorder_lock_readonly_attributes(MMHandleType handle)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);