- GstCameraControlFaceDetectInfo *fd_info = NULL;
- MMCamFaceDetectInfo *cam_fd_info = NULL;
-
- if (g_value)
- fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value);
-
- if (fd_info == NULL) {
- _mmcam_dbg_warn("fd_info is NULL");
- goto DROP_MESSAGE;
- }
-
- cam_fd_info = (MMCamFaceDetectInfo *)g_malloc(sizeof(MMCamFaceDetectInfo));
- if (cam_fd_info == NULL) {
- _mmcam_dbg_warn("cam_fd_info alloc failed");
- SAFE_FREE(fd_info);
- goto DROP_MESSAGE;
- }
-
- /* set total face count */
- cam_fd_info->num_of_faces = fd_info->num_of_faces;
-
- if (cam_fd_info->num_of_faces > 0) {
- cam_fd_info->face_info = (MMCamFaceInfo *)g_malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces);
- if (cam_fd_info->face_info) {
- /* set information of each face */
- for (i = 0 ; i < fd_info->num_of_faces ; i++) {
- cam_fd_info->face_info[i].id = fd_info->face_info[i].id;
- cam_fd_info->face_info[i].score = fd_info->face_info[i].score;
- cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x;
- cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y;
- cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width;
- cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height;
- /*
- _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]",
- fd_info->face_info[i].id,
- fd_info->face_info[i].score,
- fd_info->face_info[i].rect.x,
- fd_info->face_info[i].rect.y,
- fd_info->face_info[i].rect.width,
- fd_info->face_info[i].rect.height);
- */
- }
- } else {
- _mmcam_dbg_warn("MMCamFaceInfo alloc failed");
-
- /* free allocated memory that is not sent */
- SAFE_G_FREE(cam_fd_info);
- }
- } else {
- cam_fd_info->face_info = NULL;
- }
-
- if (cam_fd_info) {
- /* send message - cam_fd_info should be freed by application */
- msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO;
- msg.param.data = cam_fd_info;
- msg.param.size = sizeof(MMCamFaceDetectInfo);
- msg.param.code = 0;
-
- _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
- }
-
- /* free fd_info allocated by plugin */
- free(fd_info);
- fd_info = NULL;
-
- goto DROP_MESSAGE;
- } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-Capture")) {
- int capture_done = FALSE;
-
- if (gst_structure_get_int(gst_message_get_structure(message), "capture-done", &capture_done)) {
- if (sc->info_image) {
- /* play capture sound */
- _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE01, FALSE);
- }
- }
-
- goto DROP_MESSAGE;
- }
- }
-
- return GST_BUS_PASS;
-
-DROP_MESSAGE:
- gst_message_unref(message);
- message = NULL;
-
- return GST_BUS_DROP;
-}
-
-
-GstBusSyncReply _mmcamcorder_encode_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data)
-{
- GstElement *element = NULL;
- GError *err = NULL;
- gchar *debug_info = NULL;
-
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data);
- _MMCamcorderSubContext *sc = NULL;
-
- mmf_return_val_if_fail(hcamcorder, GST_BUS_PASS);
- mmf_return_val_if_fail(message, GST_BUS_PASS);
-
- sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
- mmf_return_val_if_fail(sc, GST_BUS_PASS);
-
- if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS) {
- _mmcam_dbg_log("got EOS from pipeline");
-
- _MMCAMCORDER_LOCK(hcamcorder);
-
- sc->bget_eos = TRUE;
- _MMCAMCORDER_SIGNAL(hcamcorder);
-
- _MMCAMCORDER_UNLOCK(hcamcorder);
-
- goto DROP_MESSAGE;
- } else if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) {
- _MMCamcorderMsgItem msg;
-
- /* parse error message */
- gst_message_parse_error(message, &err, &debug_info);
-
- if (debug_info) {
- _mmcam_dbg_err("GST ERROR : %s", debug_info);
- g_free(debug_info);
- debug_info = NULL;
- }
-
- if (!err) {
- _mmcam_dbg_warn("failed to parse error message");
- return GST_BUS_PASS;
- }
-
- /* set videosrc element to compare */
- element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst);
-
- /* check domain[RESOURCE] and element[AUDIOSRC] */
- if (err->domain == GST_RESOURCE_ERROR &&
- GST_ELEMENT_CAST(message->src) == element) {
- switch (err->code) {
- case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
- case GST_RESOURCE_ERROR_OPEN_WRITE:
- _mmcam_dbg_err("audio device [open failed]");
-
- /* post error to application */
- hcamcorder->error_occurs = TRUE;
- hcamcorder->error_code = MM_ERROR_COMMON_INVALID_PERMISSION;
-
- msg.id = MM_MESSAGE_CAMCORDER_ERROR;
- msg.param.code = hcamcorder->error_code;
-
- _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
-
- _mmcam_dbg_err(" error : sc->error_occurs %d", hcamcorder->error_occurs);