#define THUMBNAIL_JPEG_QUALITY 90
#define TRY_LOCK_MAX_COUNT 100
#define TRY_LOCK_TIME 20000 /* ms */
-#define H264_PREVIEW_BITRATE 1024*10 /* kbps */
-#define H264_PREVIEW_NEWGOP_INTERVAL 1000 /* ms */
#define _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE
_MMCamcorderSubContext *sc = NULL;
int display_reuse_hint = FALSE;
GstElement *sink_element = NULL;
- mmf_attrs_t *attrs = NULL;
+ MMHandleType attrs;
int attr_index = 0;
- mmf_attribute_t *attr_item = NULL;
mmf_return_if_fail(hcamcorder);
goto _REUSE_CHECK_DONE;
}
- attrs = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
+ attrs = MMF_CAMCORDER_ATTRS(handle);
if (!attrs) {
_mmcam_dbg_warn("attribute is NULL");
goto _REUSE_CHECK_DONE;
/* set sink element pointer to attribute */
mm_attrs_get_index((MMHandleType)attrs, MMCAM_DISPLAY_REUSE_ELEMENT, &attr_index);
- attr_item = &attrs->items[attr_index];
- mmf_attribute_set_data(attr_item, (void *)sink_element, sizeof(*sink_element));
- mmf_attribute_commit(attr_item);
+ mm_attrs_set_data(attrs, attr_index, (void *)sink_element, sizeof(*sink_element));
+ mm_attrs_commit(attrs, attr_index);
/* remove notify callback */
g_object_weak_unref(G_OBJECT(sink_element), (GWeakNotify)_mmcamcorder_element_release_noti, sc);
int width = 0;
int height = 0;
int fps = 0;
- int cap_format = MM_PIXEL_FORMAT_NV12;
int image_encoder = MM_IMAGE_CODEC_JPEG;
int strobe_mode = MM_CAMCORDER_STROBE_MODE_OFF;
int is_modified_size = FALSE;
MMCAM_CAMERA_WIDTH, &width,
MMCAM_CAMERA_HEIGHT, &height,
MMCAM_CAMERA_FPS, &fps,
- MMCAM_CAPTURE_FORMAT, &cap_format,
+ MMCAM_CAPTURE_FORMAT, &info->capture_format,
MMCAM_CAPTURE_WIDTH, &info->width,
MMCAM_CAPTURE_HEIGHT, &info->height,
MMCAM_CAPTURE_COUNT, &info->count,
}
_mmcam_dbg_log("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d), interval (%d)",
- width, height, info->preview_format, info->width, info->height, cap_format,
+ width, height, info->preview_format, info->width, info->height, info->capture_format,
info->count, info->hdr_capture_mode, info->interval);
/* check state */
if (!sc->bencbin_capture) {
/* Check encoding method */
- if (cap_format == MM_PIXEL_FORMAT_ENCODED) {
+ if (info->capture_format == MM_PIXEL_FORMAT_ENCODED) {
if ((sc->SensorEncodedCapture && info->type == _MMCamcorder_SINGLE_SHOT) ||
hcamcorder->support_zsl_capture || is_modified_size) {
- cap_fourcc = _mmcamcorder_get_fourcc(cap_format, image_encoder, hcamcorder->use_zero_copy_format);
+ cap_fourcc = _mmcamcorder_get_fourcc(info->capture_format, image_encoder, hcamcorder->use_zero_copy_format);
_mmcam_dbg_log("Sensor JPEG Capture [is_modified_size:%d]", is_modified_size);
} else {
/* no need to encode internally if ITLV format */
cap_fourcc, cap_fourcc>>8, cap_fourcc>>16, cap_fourcc>>24);
}
} else {
- cap_fourcc = _mmcamcorder_get_fourcc(cap_format, MM_IMAGE_CODEC_INVALID, hcamcorder->use_zero_copy_format);
+ cap_fourcc = _mmcamcorder_get_fourcc(info->capture_format, MM_IMAGE_CODEC_INVALID, hcamcorder->use_zero_copy_format);
}
- _mmcam_dbg_log("capture format (%d)", cap_format);
+ _mmcam_dbg_log("capture format (%d)", info->capture_format);
/* Note: width/height of capture is set in commit function of attribute or in create function of pipeline */
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-fourcc", cap_fourcc);
int height = 0;
int fps = 0;
int rotation = 0;
+ int bitrate = 0;
+ int gop_interval = 0;
unsigned int current_framecount = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
gboolean fps_auto = FALSE;
return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
}
+ current_framecount = sc->kpi.video_framecount;
+
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
gst_camera_control_set_capture_command(control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP);
- current_framecount = sc->kpi.video_framecount;
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
if (info->type == _MMCamcorder_SINGLE_SHOT) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
}
} else {
int focus_mode = 0;
- mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
+ MMHandleType attrs = MMF_CAMCORDER_ATTRS(handle);
/* This case is starting of preview */
ret = mm_camcorder_get_attributes(handle, &err_name,
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto);
/* set focus mode */
- if (attr) {
+ if (attrs) {
if (_mmcamcorder_check_supported_attribute(handle, MM_CAM_CAMERA_FOCUS_MODE)) {
- mmf_attribute_set_modified(&(attr->items[MM_CAM_CAMERA_FOCUS_MODE]));
- mmf_attrs_commit((MMHandleType)attr);
+ mm_attrs_set_modified(attrs, MM_CAM_CAMERA_FOCUS_MODE);
+ mm_attrs_commit(attrs, MM_CAM_CAMERA_FOCUS_MODE);
} else {
_mmcam_dbg_log("focus mode is not supported");
}
int try_count = 0;
if (hcamcorder->support_zsl_capture == FALSE) {
- mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
+ MMHandleType attrs = MMF_CAMCORDER_ATTRS(handle);
/* Set strobe mode - strobe mode can not be set to driver while captuing */
- if (attr) {
- mmf_attribute_set_modified(&(attr->items[MM_CAM_STROBE_MODE]));
- if (mmf_attrs_commit((MMHandleType) attr) == -1)
+ if (attrs) {
+ mm_attrs_set_modified(attrs, MM_CAM_STROBE_MODE);
+ if (mm_attrs_commit(attrs, MM_CAM_STROBE_MODE) == -1)
_mmcam_dbg_warn("Failed to set strobe mode");
}
_mmcamcorder_sound_finalize(handle);
} else {
if (info->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "bitrate", H264_PREVIEW_BITRATE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "newgop-interval", H264_PREVIEW_NEWGOP_INTERVAL);
+ ret = mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_ENCODED_PREVIEW_BITRATE, &bitrate,
+ MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, &gop_interval,
+ NULL);
+ if (ret == MM_ERROR_NONE) {
+ _mmcamcorder_set_encoded_preview_bitrate(handle, bitrate);
+ _mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval);
+ } else {
+ _mmcam_dbg_err("failed to get encoded preview setting");
+ }
}
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
int pixtype_thumb = MM_PIXEL_FORMAT_INVALID;
int pixtype_scrnl = MM_PIXEL_FORMAT_INVALID;
int codectype = MM_IMAGE_CODEC_JPEG;
- int attr_index = 0;
int count = 0;
int stop_cont_shot = FALSE;
int tag_enable = FALSE;
GstMapInfo mapinfo2;
GstMapInfo mapinfo3;
- mmf_attrs_t *attrs = NULL;
- mmf_attribute_t *item_screennail = NULL;
- mmf_attribute_t *item_exif_raw_data = NULL;
+ MMHandleType attrs;
+ int attr_index_for_screennail = 0;
+ int attr_index_for_exif = 0;
mmf_return_if_fail(hcamcorder);
goto error;
} else {
if ((mapinfo1.data == NULL) && (mapinfo1.size == 0)) {
- _mmcam_dbg_err("mapinfo1 is wrong (%p, size %d)", mapinfo1.data, mapinfo1.size);
+ _mmcam_dbg_err("mapinfo1 is wrong (%p, size %zu)", mapinfo1.data, mapinfo1.size);
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
goto error;
_mmcam_dbg_log("sample3[%p] is NULL or gst_buffer_map failed. Not Error.", sample3);
/* Screennail image buffer */
- attrs = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(hcamcorder);
- mm_attrs_get_index((MMHandleType)attrs, MMCAM_CAPTURED_SCREENNAIL, &attr_index);
- item_screennail = &attrs->items[attr_index];
+ attrs = MMF_CAMCORDER_ATTRS(hcamcorder);
+ mm_attrs_get_index(attrs, MMCAM_CAPTURED_SCREENNAIL, &attr_index_for_screennail);
if (sample3 && mapinfo3.data && mapinfo3.size != 0) {
- _mmcam_dbg_log("Screennail (sample3=%p,size=%d)", sample3, mapinfo3.size);
+ _mmcam_dbg_log("Screennail (sample3=%p,size=%zu)", sample3, mapinfo3.size);
pixtype_scrnl = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample3));
__mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_scrnl, sample3);
/* Set screennail attribute for application */
- ret = mmf_attribute_set_data(item_screennail, &scrnail, sizeof(scrnail));
- _mmcam_dbg_log("Screennail set attribute data %p, size %d, ret %x", &scrnail, sizeof(scrnail), ret);
+ ret = mm_attrs_set_data(attrs, attr_index_for_screennail, &scrnail, sizeof(scrnail));
+ _mmcam_dbg_log("Screennail set attribute data %p, size %zu, ret %x", &scrnail, sizeof(scrnail), ret);
} else {
_mmcam_dbg_log("Sample3 has wrong pointer. Not Error. (sample3=%p)", sample3);
- mmf_attribute_set_data(item_screennail, NULL, 0);
+ mm_attrs_set_data(attrs, attr_index_for_screennail, NULL, 0);
}
/* commit screennail data */
- mmf_attribute_commit(item_screennail);
+ mm_attrs_commit(attrs, attr_index_for_screennail);
/* init thumb data */
memset(&encode_src, 0x0, sizeof(MMCamcorderCaptureDataType));
_mmcam_dbg_log("Done Internal Encode - data %p, length %d", dest.data, dest.length);
}
- if (pixtype_main < MM_PIXEL_FORMAT_ENCODED) {
- _mmcam_dbg_log("raw capture, skip EXIF related functions");
+ if (info->capture_format != MM_PIXEL_FORMAT_ENCODED) {
+ _mmcam_dbg_log("not encoded format, skip exif related sequence");
goto _CAPTURE_CB_EXIF_DONE;
}
}
/* get attribute item for EXIF data */
- mm_attrs_get_index((MMHandleType)attrs, MMCAM_CAPTURED_EXIF_RAW_DATA, &attr_index);
- item_exif_raw_data = &attrs->items[attr_index];
+ mm_attrs_get_index((MMHandleType)attrs, MMCAM_CAPTURED_EXIF_RAW_DATA, &attr_index_for_exif);
/* set EXIF data to attribute */
if (hcamcorder->exif_info && hcamcorder->exif_info->data) {
exif_raw_data = (unsigned char *)malloc(hcamcorder->exif_info->size);
if (exif_raw_data) {
memcpy(exif_raw_data, hcamcorder->exif_info->data, hcamcorder->exif_info->size);
- mmf_attribute_set_data(item_exif_raw_data, exif_raw_data, hcamcorder->exif_info->size);
+ mm_attrs_set_data(attrs, attr_index_for_exif, exif_raw_data, hcamcorder->exif_info->size);
_mmcam_dbg_log("set EXIF raw data %p, size %d", exif_raw_data, hcamcorder->exif_info->size);
} else {
_mmcam_dbg_warn("failed to alloc for EXIF, size %d", hcamcorder->exif_info->size);
}
} else {
_mmcam_dbg_warn("failed to create EXIF. set EXIF as NULL");
- mmf_attribute_set_data(item_exif_raw_data, NULL, 0);
+ mm_attrs_set_data(attrs, attr_index_for_exif, NULL, 0);
}
/* commit EXIF data */
- mmf_attribute_commit(item_exif_raw_data);
+ mm_attrs_commit(attrs, attr_index_for_exif);
/* get tag-enable */
mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_TAG_ENABLE, &tag_enable, NULL);
_MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(hcamcorder);
/* init screennail and EXIF raw data */
- mmf_attribute_set_data(item_screennail, NULL, 0);
- mmf_attribute_commit(item_screennail);
+ mm_attrs_set_data(attrs, attr_index_for_screennail, NULL, 0);
+ mm_attrs_commit(attrs, attr_index_for_screennail);
if (exif_raw_data) {
free(exif_raw_data);
exif_raw_data = NULL;
- mmf_attribute_set_data(item_exif_raw_data, NULL, 0);
- mmf_attribute_commit(item_exif_raw_data);
+ mm_attrs_set_data(attrs, attr_index_for_exif, NULL, 0);
+ mm_attrs_commit(attrs, attr_index_for_exif);
}
/* Release jpeg data */