#include <stdlib.h>
#include <sys/time.h>
#include <sys/times.h>
-#include <gst/video/cameracontrol.h>
#include "mm_camcorder_internal.h"
#include "mm_camcorder_stillshot.h"
#include "mm_camcorder_exifinfo.h"
---------------------------------------------------------------------------------------*/
#define EXIF_SET_ERR(return_type, tag_id) \
do { \
- _mmcam_dbg_err("error=%x,tag=%x", return_type, tag_id); \
+ MMCAM_LOG_ERROR("error=%x,tag=%x", return_type, tag_id); \
if (return_type == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) { \
goto exit; \
} \
#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
int _mmcamcorder_image_cmd_preview_start(MMHandleType handle);
int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle);
static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sample1, GstSample *sample2, GstSample *sample3, gpointer u_data);
+static void __mmcamcorder_extra_preview_stream_cb(GstElement *element, int stream_id, GstSample *sample, gpointer u_data);
/* sound status changed callback */
static void __sound_status_changed_cb(keynode_t* node, void *data);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
/* Create gstreamer element */
- _mmcam_dbg_log("Using Encodebin for capturing");
+ MMCAM_LOG_INFO("Using Encodebin for capturing");
/* Create capture pipeline */
_MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "capture_pipeline", err);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- /* check video source element */
- if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
- _mmcam_dbg_warn("connect capture signal to _MMCAMCORDER_VIDEOSRC_SRC");
- MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst,
- _MMCAMCORDER_HANDLER_STILLSHOT, "still-capture",
- G_CALLBACK(__mmcamcorder_image_capture_cb),
- hcamcorder);
+ mmf_return_val_if_fail(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- return MM_ERROR_NONE;
- } else {
- _mmcam_dbg_err("videosrc element is not created yet");
- return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
+ MMCAM_LOG_INFO("connect capture signal to _MMCAMCORDER_VIDEOSRC_SRC");
+
+ MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst,
+ _MMCAMCORDER_HANDLER_STILLSHOT, "still-capture",
+ G_CALLBACK(__mmcamcorder_image_capture_cb),
+ hcamcorder);
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_initialize_extra_preview_stream(MMHandleType handle)
+{
+ int i = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = NULL;
+ GstCameraControl *control = NULL;
+ _MMCamcorderExtraPreviewStreamFormat *e_fmt = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ mmf_return_val_if_fail(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ MMCAM_LOG_INFO("connect extra preview stream signal to _MMCAMCORDER_VIDEOSRC_SRC");
+
+ MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst,
+ _MMCAMCORDER_HANDLER_EXTRA_PREVIEW, "extra-preview-stream-cb",
+ G_CALLBACK(__mmcamcorder_extra_preview_stream_cb),
+ hcamcorder);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!control) {
+ MMCAM_LOG_ERROR("no camera control");
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
}
+
+ for (i = 0 ; i < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM ; i++) {
+ e_fmt = &hcamcorder->extra_preview_format[i];
+
+ if (e_fmt->need_to_set_format) {
+ if (!gst_camera_control_set_extra_preview_stream_format(control,
+ i, _mmcamcorder_get_pixel_format2(e_fmt->pixel_format),
+ e_fmt->width, e_fmt->height, e_fmt->fps))
+ MMCAM_LOG_WARNING("set format[%d,%dx%d,%d] failed for stream[%d]",
+ e_fmt->pixel_format, e_fmt->width, e_fmt->height, e_fmt->fps, i);
+
+ e_fmt->need_to_set_format = FALSE;
+ }
+
+ if (e_fmt->need_to_set_bitrate) {
+ if (!gst_camera_control_set_extra_preview_bitrate(control, i, e_fmt->bitrate))
+ MMCAM_LOG_WARNING("set bitrate[%d] failed for stream[%d]", e_fmt->bitrate, i);
+
+ e_fmt->need_to_set_bitrate = FALSE;
+ }
+
+ if (e_fmt->need_to_set_gop_interval) {
+ if (!gst_camera_control_set_extra_preview_gop_interval(control, i, e_fmt->gop_interval))
+ MMCAM_LOG_WARNING("set GOP interval[%d] failed for stream[%d]", e_fmt->gop_interval, i);
+
+ e_fmt->need_to_set_gop_interval = FALSE;
+ }
+ }
+
+ return MM_ERROR_NONE;
}
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
/* Check pipeline */
if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Faile to change encode main pipeline state [0x%x]", ret);
+ MMCAM_LOG_ERROR("Failed to change encode main pipeline state [0x%x]", ret);
return ret;
}
/* release encode main pipeline */
gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
- _mmcam_dbg_log("Encoder pipeline removed");
+ MMCAM_LOG_INFO("Encoder pipeline removed");
} else {
- _mmcam_dbg_log("encode main pipeline is already removed");
+ MMCAM_LOG_INFO("encode main pipeline is already removed");
}
return MM_ERROR_NONE;
_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);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_if_fail(sc && sc->element);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
MMCAM_DISPLAY_REUSE_HINT, &display_reuse_hint,
NULL);
- _mmcam_dbg_log("display reuse hint %d", display_reuse_hint);
+ MMCAM_LOG_INFO("display reuse hint %d", display_reuse_hint);
if (!display_reuse_hint)
goto _REUSE_CHECK_DONE;
sink_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
if (!sink_element) {
- _mmcam_dbg_warn("sink element is NULL");
+ MMCAM_LOG_WARNING("sink element is NULL");
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");
+ MMCAM_LOG_WARNING("attribute is NULL");
goto _REUSE_CHECK_DONE;
}
- _mmcam_dbg_log("REF sink element %p and set it to attribute", sink_element);
+ MMCAM_LOG_INFO("REF sink element %p and set it to attribute", sink_element);
/* ref element before remove it from pipeline */
gst_object_ref(sink_element);
if (!gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), sink_element))
- _mmcam_dbg_warn("failed to remove sink element from pipeline");
+ MMCAM_LOG_WARNING("failed to remove sink element from pipeline");
/* reset floating reference flag to avoid leak after next use */
g_object_force_floating(G_OBJECT(sink_element));
/* 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;
int tag_orientation = 0;
unsigned int cap_fourcc = 0;
-
char *err_name = NULL;
- const char *videosrc_name = NULL;
GstCameraControl *control = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderImageInfo *info = NULL;
_MMCamcorderSubContext *sc = NULL;
- type_element *VideosrcElement = NULL;
MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
info = sc->info_image;
if (info->capturing) {
- _mmcam_dbg_err("already capturing");
+ MMCAM_LOG_ERROR("already capturing");
return MM_ERROR_CAMCORDER_DEVICE_BUSY;
}
"UseCaptureMode",
&UseCaptureMode);
- _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "VideosrcElement",
- &VideosrcElement);
-
- _mmcamcorder_conf_get_value_element_name(VideosrcElement, &videosrc_name);
-
/* get current state */
mm_camcorder_get_state(handle, ¤t_state);
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_TAG_ORIENTATION, &tag_orientation,
NULL);
if (err_name) {
- _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
+ MMCAM_LOG_WARNING("get_attributes err %s, ret 0x%x", err_name, ret);
SAFE_FREE(err_name);
}
/* check capture count */
if (info->count < 1) {
- _mmcam_dbg_err("capture count[%d] is invalid", info->count);
+ MMCAM_LOG_ERROR("capture count[%d] is invalid", info->count);
ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
goto cmd_done;
} else if (info->count == 1) {
_mmcamcorder_sound_init(handle);
}
- _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,
+ MMCAM_LOG_INFO("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, info->capture_format,
info->count, info->hdr_capture_mode, info->interval);
/* check state */
if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
if (sc->bencbin_capture) {
- _mmcam_dbg_err("could not capture in this target while recording");
+ MMCAM_LOG_ERROR("could not capture in this target while recording");
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto cmd_done;
}
if (info->type == _MMCamcorder_MULTI_SHOT ||
info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF) {
- _mmcam_dbg_err("does not support multi/HDR capture while recording");
+ MMCAM_LOG_ERROR("does not support multi/HDR capture while recording");
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto cmd_done;
}
/* check capture size if ZSL is not supported*/
if (hcamcorder->support_zsl_capture == FALSE) {
- _mmcam_dbg_warn("Capture size should be same with preview size while recording");
- _mmcam_dbg_warn("Capture size %dx%d -> %dx%d", info->width, info->height, width, height);
+ MMCAM_LOG_WARNING("Capture size should be same with preview size while recording");
+ MMCAM_LOG_WARNING("Capture size %dx%d -> %dx%d", info->width, info->height, width, height);
info->width = width;
info->height = height;
- _mmcam_dbg_log("set capture width and height [%dx%d] to camera plugin", width, height);
+ MMCAM_LOG_INFO("set capture width and height [%dx%d] to camera plugin", width, height);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", width);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", height);
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);
- _mmcam_dbg_log("Sensor JPEG Capture [is_modified_size:%d]", is_modified_size);
+ cap_fourcc = _mmcamcorder_get_fourcc(info->capture_format, image_encoder, hcamcorder->use_zero_copy_format);
+ MMCAM_LOG_INFO("Sensor JPEG Capture [is_modified_size:%d]", is_modified_size);
} else {
/* no need to encode internally if ITLV format */
if (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
cap_fourcc = _mmcamcorder_get_fourcc(info->preview_format, image_encoder, hcamcorder->use_zero_copy_format);
- _mmcam_dbg_log("MSL JPEG Capture : capture fourcc %c%c%c%c",
+ MMCAM_LOG_INFO("MSL JPEG Capture : capture fourcc %c%c%c%c",
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_LOG_INFO("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);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-count", info->count);
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
- _mmcam_dbg_err("Can't cast Video source into camera control.");
+ MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
goto cmd_done;
}
if (need_change) {
int rotation = 0;
- _mmcam_dbg_log("Need to change resolution");
+ MMCAM_LOG_INFO("Need to change resolution");
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
/* check decoder recreation */
if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
- _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
+ MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
return MM_ERROR_CAMCORDER_INTERNAL;
}
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to set state PAUSED %x", ret);
+ MMCAM_LOG_ERROR("failed to set state PAUSED %x", ret);
goto cmd_done;
}
MMCAM_CAMERA_ROTATION, &rotation,
NULL);
if (err_name) {
- _mmcam_dbg_warn("get_attributes err %s", err_name);
+ MMCAM_LOG_WARNING("get_attributes err %s", err_name);
SAFE_FREE(err_name);
}
/* set new caps */
ret = _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, set_width, set_height, fps, rotation);
if (!ret) {
- _mmcam_dbg_err("_mmcamcorder_set_videosrc_caps failed");
+ MMCAM_LOG_ERROR("_mmcamcorder_set_videosrc_caps failed");
ret = MM_ERROR_CAMCORDER_INTERNAL;
goto cmd_done;
}
/* make pipeline state as PLAYING */
ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to set state PLAYING %x", ret);
+ MMCAM_LOG_ERROR("failed to set state PLAYING %x", ret);
goto cmd_done;
}
- _mmcam_dbg_log("Change to target resolution(%d, %d)", set_width, set_height);
+ MMCAM_LOG_INFO("Change to target resolution(%d, %d)", set_width, set_height);
} else {
- _mmcam_dbg_log("No need to change resolution. Open toggle now.");
+ MMCAM_LOG_INFO("No need to change resolution. Open toggle now.");
info->resolution_change = FALSE;
}
/* add encodesinkbin */
ret = _mmcamcorder_create_stillshot_pipeline((MMHandleType)hcamcorder);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to create encodesinkbin %x", ret);
+ MMCAM_LOG_ERROR("failed to create encodesinkbin %x", ret);
goto cmd_done;
}
MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality,
NULL);
if (err_name) {
- _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
+ MMCAM_LOG_WARNING("get_attributes err %s, ret 0x%x", err_name, ret);
SAFE_FREE(err_name);
}
MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
/* Prepare for the shutter sound when it's the bencbin mode capture */
- sc->info_video->is_firstframe = TRUE;
+ sc->info_video->is_first_frame = TRUE;
/* set push encoding buffer as TRUE */
sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_INIT;
/* make encode pipeline state as PLAYING */
ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PLAYING);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to set state PLAYING %x", ret);
+ MMCAM_LOG_ERROR("failed to set state PLAYING %x", ret);
goto cmd_done;
}
}
if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) {
hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE;
- _mmcam_dbg_log("send signal for capture in recording");
+ MMCAM_LOG_INFO("send signal for capture in recording");
g_cond_signal(&hcamcorder->task_thread_cond);
} else {
- _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state);
+ MMCAM_LOG_WARNING("unexpected task thread state : %d", hcamcorder->task_thread_state);
}
g_mutex_unlock(&hcamcorder->task_thread_lock);
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;
char *err_name = NULL;
- const char *videosrc_name = NULL;
GstState state;
GstElement *pipeline = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderImageInfo *info = NULL;
_MMCamcorderSubContext *sc = NULL;
- type_element *VideosrcElement = NULL;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->info_image && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- /*_mmcam_dbg_log("");*/
+ /*MMCAM_LOG_INFO("");*/
pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
info = sc->info_image;
- _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "VideosrcElement",
- &VideosrcElement);
-
- _mmcamcorder_conf_get_value_element_name(VideosrcElement, &videosrc_name);
-
sc->display_interval = 0;
sc->previous_slot_time = 0;
info->capturing = FALSE;
current_state = _mmcamcorder_get_state(handle);
- _mmcam_dbg_log("current state [%d]", current_state);
+ MMCAM_LOG_INFO("current state [%d]", current_state);
if (!sc->bencbin_capture) {
- _mmcam_dbg_log("Preview start");
+ MMCAM_LOG_INFO("Preview start");
/* just set capture stop command if current state is CAPTURING */
if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
- _mmcam_dbg_err("Can't cast Video source into camera control.");
+ MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
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,
MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
NULL);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret);
+ MMCAM_LOG_WARNING("Get attrs fail. (%s:%x)", err_name, ret);
SAFE_FREE(err_name);
}
- _mmcam_dbg_log("focus mode %d", focus_mode);
+ MMCAM_LOG_INFO("focus mode %d", focus_mode);
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);
+
+ if (focus_mode == MM_CAMCORDER_FOCUS_MODE_MANUAL) {
+ mm_attrs_set_modified(attrs, MM_CAM_CAMERA_FOCUS_LEVEL);
+ mm_attrs_commit(attrs, MM_CAM_CAMERA_FOCUS_LEVEL);
+ }
} else {
- _mmcam_dbg_log("focus mode is not supported");
+ MMCAM_LOG_INFO("focus mode is not supported");
}
} else {
- _mmcam_dbg_err("failed to get attributes");
+ MMCAM_LOG_ERROR("failed to get attributes");
}
}
}
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)
- _mmcam_dbg_warn("Failed to set strobe mode");
+ /* Set strobe mode - strobe mode can not be set to driver while capturing */
+ if (attrs) {
+ mm_attrs_set_modified(attrs, MM_CAM_STROBE_MODE);
+ if (mm_attrs_commit(attrs, MM_CAM_STROBE_MODE) == -1)
+ MMCAM_LOG_WARNING("Failed to set strobe mode");
}
while (current_framecount >= sc->kpi.video_framecount &&
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
}
- _mmcam_dbg_log("Wait Frame Done. count before[%d],after[%d], try_count[%d]",
+ MMCAM_LOG_INFO("Wait Frame Done. count before[%d],after[%d], try_count[%d]",
current_framecount, sc->kpi.video_framecount, try_count);
} else {
ret = _mmcamcorder_remove_stillshot_pipeline(handle);
/* check decoder recreation */
if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) {
- _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
+ MMCAM_LOG_ERROR("_mmcamcorder_recreate_decoder_for_encoded_preview failed");
return MM_ERROR_CAMCORDER_INTERNAL;
}
MMCAM_CAMERA_ROTATION, &rotation,
NULL);
if (err_name) {
- _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
+ MMCAM_LOG_WARNING("get_attributes err %s, ret 0x%x", err_name, ret);
SAFE_FREE(err_name);
}
/* set new caps */
ret = _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, rotation);
if (!ret) {
- _mmcam_dbg_err("_mmcamcorder_set_videosrc_caps failed");
+ MMCAM_LOG_ERROR("_mmcamcorder_set_videosrc_caps failed");
ret = MM_ERROR_CAMCORDER_INTERNAL;
goto cmd_error;
}
if (info->type == _MMCamcorder_MULTI_SHOT)
_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);
+ if (_mmcamcorder_is_encoded_preview_pixel_format(info->preview_format)) {
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_ENCODED_PREVIEW_BITRATE, &bitrate,
+ MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, &gop_interval,
+ NULL);
+
+ _mmcamcorder_set_encoded_preview_bitrate(handle, bitrate);
+ _mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval);
}
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
/* get sound status/volume level and register changed_cb */
if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_OFF &&
info->sound_status == _SOUND_STATUS_INIT) {
- _mmcam_dbg_log("register vconf changed_cb and get sound status");
+ MMCAM_LOG_INFO("register vconf changed_cb and get sound status");
/* register changed_cb */
vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb, hcamcorder);
/* get sound status */
vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status));
- _mmcam_dbg_log("sound status %d", info->sound_status);
+ MMCAM_LOG_INFO("sound status %d", info->sound_status);
}
}
_MMCamcorderSubContext *sc = NULL;
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
NULL);
if (strobe_mode == MM_CAMCORDER_STROBE_MODE_PERMANENT &&
GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
- _mmcam_dbg_log("current strobe mode is PERMANENT, set OFF");
+ MMCAM_LOG_INFO("current strobe mode is PERMANENT, set OFF");
/* get camera control */
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
/* set strobe OFF */
gst_camera_control_set_strobe(control, GST_CAMERA_CONTROL_STROBE_MODE, set_strobe);
- _mmcam_dbg_log("set strobe OFF done - value: %d", set_strobe);
+ MMCAM_LOG_INFO("set strobe OFF done - value: %d", set_strobe);
} else {
- _mmcam_dbg_warn("cast CAMERA_CONTROL failed");
+ MMCAM_LOG_WARNING("cast CAMERA_CONTROL failed");
}
}
pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
- _mmcam_dbg_log("pipeline is exist so need to remove pipeline and sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst=%p",
+ MMCAM_LOG_INFO("pipeline is exist so need to remove pipeline and sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst=%p",
sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
_mmcamcorder_remove_recorder_pipeline(handle);
}
MMCAM_DISPLAY_REUSE_HINT, &display_reuse_hint,
NULL);
- _mmcam_dbg_log("display reuse hint %d", display_reuse_hint);
+ MMCAM_LOG_INFO("display reuse hint %d", display_reuse_hint);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "keep-camera-preview", display_reuse_hint);
/* deregister sound status callback */
if (sc->info_image->sound_status != _SOUND_STATUS_INIT) {
- _mmcam_dbg_log("deregister sound status callback");
+ MMCAM_LOG_INFO("deregister sound status callback");
vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("command %d", command);
+ MMCAM_LOG_INFO("command %d", command);
switch (command) {
case _MMCamcorder_CMD_CAPTURE:
info = sc->info_image;
- _mmcam_dbg_log("capture type[%d], capture send count[%d]", info->type, info->capture_send_count);
+ MMCAM_LOG_INFO("capture type[%d], capture send count[%d]", info->type, info->capture_send_count);
if (info->type == _MMCamcorder_SINGLE_SHOT || info->capture_send_count == info->count) {
info->capture_cur_count = 0;
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
mmf_return_val_if_fail(sc, FALSE);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
if (!original || original->data == NULL || original->length == 0) {
if (original) {
- _mmcam_dbg_err("data=%p, length=%d",
+ MMCAM_LOG_ERROR("data=%p, length=%d",
original->data, original->length);
} else {
- _mmcam_dbg_err("original is null");
+ MMCAM_LOG_ERROR("original is null");
}
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
if (provide_exif == FALSE) {
if (thumbnail) {
if (thumbnail->data && thumbnail->length > 0) {
- _mmcam_dbg_log("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d",
+ MMCAM_LOG_INFO("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d",
thumbnail->data, thumbnail->width, thumbnail->height);
/* add thumbnail exif info */
thumbnail->height,
thumbnail->length);
} else {
- _mmcam_dbg_err("Skip adding thumbnail (data=%p, length=%d)",
+ MMCAM_LOG_ERROR("Skip adding thumbnail (data=%p, length=%d)",
thumbnail->data, thumbnail->length);
}
}
/* write jpeg with exif */
ret = mm_exif_write_exif_jpeg_to_memory(&original->data, &original->length, hcamcorder->exif_info, data, datalen);
if (ret != MM_ERROR_NONE)
- _mmcam_dbg_err("mm_exif_write_exif_jpeg_to_memory error! [0x%x]", ret);
+ MMCAM_LOG_ERROR("mm_exif_write_exif_jpeg_to_memory error! [0x%x]", ret);
}
- _mmcam_dbg_log("END ret 0x%x", ret);
+ MMCAM_LOG_INFO("END ret 0x%x", ret);
return ret;
}
caps = gst_sample_get_caps(sample);
if (caps == NULL) {
- _mmcam_dbg_err("failed to get caps");
+ MMCAM_LOG_ERROR("failed to get caps");
goto GET_FAILED;
}
structure = gst_caps_get_structure(caps, 0);
if (structure == NULL) {
- _mmcam_dbg_err("failed to get structure");
+ MMCAM_LOG_ERROR("failed to get structure");
goto GET_FAILED;
}
gst_buffer_map(gst_sample_get_buffer(sample), &mapinfo, GST_MAP_READ);
capture_data->data = mapinfo.data;
capture_data->format = pixtype;
- gst_structure_get_int(structure, "width", &capture_data->width);
- gst_structure_get_int(structure, "height", &capture_data->height);
+ gst_structure_get(structure,
+ "width", G_TYPE_INT, &capture_data->width,
+ "height", G_TYPE_INT, &capture_data->height,
+ NULL);
capture_data->length = mapinfo.size;
gst_buffer_unmap(gst_sample_get_buffer(sample), &mapinfo);
- _mmcam_dbg_warn("buffer data[%p],size[%dx%d],length[%d],format[%d]",
+ MMCAM_LOG_WARNING("buffer data[%p],size[%dx%d],length[%d],format[%d]",
capture_data->data, capture_data->width, capture_data->height,
capture_data->length, capture_data->format);
return;
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
/* if tag enable and doesn't provide exif, we make it */
- _mmcam_dbg_log("Add exif information if existed(thumbnail[%p])", thumbnail);
+ MMCAM_LOG_INFO("Add exif information if existed(thumbnail[%p])", thumbnail);
if (thumbnail && thumbnail->data)
return __mmcamcorder_capture_save_exifinfo(handle, dest, thumbnail, provide_exif);
else
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
mmf_return_if_fail(sc);
- _mmcam_dbg_log("tag : %d, provide exif : %d", tag_enable, provide_exif);
+ MMCAM_LOG_INFO("tag : %d, provide exif : %d", tag_enable, provide_exif);
/* if dest->data is allocated in MSL, release it */
if (tag_enable && !provide_exif) {
free(dest->data);
dest->length = 0;
dest->data = NULL;
- _mmcam_dbg_log("Jpeg is released!");
+ MMCAM_LOG_INFO("Jpeg is released!");
}
} else {
- _mmcam_dbg_log("No need to release");
+ MMCAM_LOG_INFO("No need to release");
}
return;
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);
/* get current state */
current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
- _mmcam_dbg_err("START - current state %d", current_state);
+ MMCAM_LOG_ERROR("START - current state %d", current_state);
/* check capture state */
if (info->type == _MMCamcorder_MULTI_SHOT && info->capture_send_count > 0)
NULL);
if (!info->capturing || stop_cont_shot) {
- _mmcam_dbg_warn("stop command[%d] or not capturing state[%d]. skip this...", stop_cont_shot, info->capturing);
+ MMCAM_LOG_WARNING("stop command[%d] or not capturing state[%d]. skip this...", stop_cont_shot, info->capturing);
/* set FALSE here for the case that info->capturing is still FALSE
(== capture_send_count is 0 at the time _mmcamcorder_commit_capture_break_cont_shot is called) */
wait for 2 seconds at worst case */
try_lock_count = 0;
do {
- _mmcam_dbg_log("Try command LOCK");
+ MMCAM_LOG_INFO("Try command LOCK");
if (_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
- _mmcam_dbg_log("command LOCK OK");
+ MMCAM_LOG_INFO("command LOCK OK");
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
break;
}
if (try_lock_count++ < TRY_LOCK_MAX_COUNT) {
- _mmcam_dbg_warn("command LOCK Failed, retry...[count %d]", try_lock_count);
+ MMCAM_LOG_WARNING("command LOCK Failed, retry...[count %d]", try_lock_count);
usleep(TRY_LOCK_TIME);
} else {
- _mmcam_dbg_err("failed to lock command LOCK");
+ MMCAM_LOG_ERROR("failed to lock command LOCK");
break;
}
} while (TRUE);
or preview format is ITLV(because of AF and flash control in plugin) */
if (info->type == _MMCamcorder_MULTI_SHOT) {
g_mutex_lock(&hcamcorder->task_thread_lock);
- _mmcam_dbg_log("send signal for sound play");
+ MMCAM_LOG_INFO("send signal for sound play");
hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START;
g_cond_signal(&hcamcorder->task_thread_cond);
g_mutex_unlock(&hcamcorder->task_thread_lock);
/* Prepare main, thumbnail buffer */
pixtype_main = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample1));
if (pixtype_main == MM_PIXEL_FORMAT_INVALID) {
- _mmcam_dbg_err("Unsupported pixel type");
+ MMCAM_LOG_ERROR("Unsupported pixel type");
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
goto error;
}
/* Main image buffer */
if (!sample1 || !gst_buffer_map(gst_sample_get_buffer(sample1), &mapinfo1, GST_MAP_READ)) {
- _mmcam_dbg_err("sample1[%p] is NULL or gst_buffer_map failed", sample1);
+ MMCAM_LOG_ERROR("sample1[%p] is NULL or gst_buffer_map failed", sample1);
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
goto error;
} else {
if ((mapinfo1.data == NULL) && (mapinfo1.size == 0)) {
- _mmcam_dbg_err("mapinfo1 is wrong (%p, size %d)", mapinfo1.data, mapinfo1.size);
+ MMCAM_LOG_ERROR("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;
}
if (!sample2 || !gst_buffer_map(gst_sample_get_buffer(sample2), &mapinfo2, GST_MAP_READ))
- _mmcam_dbg_log("sample2[%p] is NULL or gst_buffer_map failed. Not Error.", sample2);
+ MMCAM_LOG_INFO("sample2[%p] is NULL or gst_buffer_map failed. Not Error.", sample2);
if (!sample3 || !gst_buffer_map(gst_sample_get_buffer(sample3), &mapinfo3, GST_MAP_READ))
- _mmcam_dbg_log("sample3[%p] is NULL or gst_buffer_map failed. Not Error.", sample3);
+ MMCAM_LOG_INFO("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_LOG_INFO("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_LOG_INFO("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);
+ MMCAM_LOG_INFO("Sample3 has wrong pointer. Not Error. (sample3=%p)", sample3);
+ 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));
/* Thumbnail image buffer */
if (sample2 && mapinfo2.data && (mapinfo2.size != 0)) {
- _mmcam_dbg_log("Thumbnail (buffer2=%p)", gst_sample_get_buffer(sample2));
+ MMCAM_LOG_INFO("Thumbnail (buffer2=%p)", gst_sample_get_buffer(sample2));
pixtype_thumb = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample2));
__mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_thumb, sample2);
} else {
- _mmcam_dbg_log("Sample2 has wrong pointer. Not Error. (sample2 %p)", sample2);
+ MMCAM_LOG_INFO("Sample2 has wrong pointer. Not Error. (sample2 %p)", sample2);
if (pixtype_main == MM_PIXEL_FORMAT_ENCODED && provide_exif) {
ExifLoader *l;
thumb.height = atoi(height);
internal_thumb_data = thumb.data;
} else {
- _mmcam_dbg_err("failed to alloc thumbnail data");
+ MMCAM_LOG_ERROR("failed to alloc thumbnail data");
}
}
exif_data_unref(ed);
ed = NULL;
} else {
- _mmcam_dbg_warn("failed to get exif data");
+ MMCAM_LOG_WARNING("failed to get exif data");
}
} else {
- _mmcam_dbg_warn("failed to create exif loader");
+ MMCAM_LOG_WARNING("failed to create exif loader");
}
}
unsigned char *thumb_raw_data = NULL;
/* encode image */
- _mmcam_dbg_log("Encode Thumbnail");
+ MMCAM_LOG_INFO("Encode Thumbnail");
if (encode_src.width > THUMBNAIL_WIDTH) {
/* calculate thumbnail size */
if (thumb_height % 2 != 0)
thumb_height += 1;
- _mmcam_dbg_log("need to resize : thumbnail size %dx%d, format %d",
+ MMCAM_LOG_INFO("need to resize : thumbnail size %dx%d, format %d",
thumb_width, thumb_height, encode_src.format);
if ((encode_src.format == MM_PIXEL_FORMAT_UYVY ||
if (!_mmcamcorder_downscale_UYVYorYUYV(encode_src.data, encode_src.width, encode_src.height,
&thumb_raw_data, thumb_width, thumb_height)) {
thumb_raw_data = NULL;
- _mmcam_dbg_warn("_mmcamcorder_downscale_UYVYorYUYV failed. skip thumbnail making...");
+ MMCAM_LOG_WARNING("_mmcamcorder_downscale_UYVYorYUYV failed. skip thumbnail making...");
}
} else {
if (!_mmcamcorder_resize_frame(encode_src.data, encode_src.width, encode_src.height,
encode_src.length, encode_src.format,
&thumb_raw_data, &thumb_width, &thumb_height, &thumb_length)) {
thumb_raw_data = NULL;
- _mmcam_dbg_warn("_mmcamcorder_resize_frame failed. skip thumbnail making...");
+ MMCAM_LOG_WARNING("_mmcamcorder_resize_frame failed. skip thumbnail making...");
}
}
} else {
thumb_width = encode_src.width;
thumb_height = encode_src.height;
- _mmcam_dbg_log("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
+ MMCAM_LOG_INFO("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
thumb_raw_data = encode_src.data;
thumb_length = encode_src.length;
encode_src.format, thumb_length, THUMBNAIL_JPEG_QUALITY,
(void **)&internal_thumb_data, &internal_thumb_length);
if (ret) {
- _mmcam_dbg_log("encode THUMBNAIL done - data %p, length %d", internal_thumb_data, internal_thumb_length);
+ MMCAM_LOG_INFO("encode THUMBNAIL done - data %p, length %d", internal_thumb_data, internal_thumb_length);
thumb.data = internal_thumb_data;
thumb.length = internal_thumb_length;
thumb.height = thumb_height;
thumb.format = MM_PIXEL_FORMAT_ENCODED;
} else {
- _mmcam_dbg_warn("failed to encode THUMBNAIL");
+ MMCAM_LOG_WARNING("failed to encode THUMBNAIL");
}
/* release allocated raw data memory */
if (thumb_raw_data != encode_src.data) {
free(thumb_raw_data);
thumb_raw_data = NULL;
- _mmcam_dbg_log("release thumb_raw_data");
+ MMCAM_LOG_INFO("release thumb_raw_data");
}
} else {
- _mmcam_dbg_warn("thumb_raw_data is NULL");
+ MMCAM_LOG_WARNING("thumb_raw_data is NULL");
}
} else {
/* no raw data src for thumbnail */
- _mmcam_dbg_log("no need to encode thumbnail");
+ MMCAM_LOG_INFO("no need to encode thumbnail");
}
}
mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
MMCAM_IMAGE_ENCODER_QUALITY, &capture_quality,
NULL);
- _mmcam_dbg_log("Start Internal Encode - capture_quality %d", capture_quality);
+ MMCAM_LOG_INFO("Start Internal Encode - capture_quality %d", capture_quality);
ret = _mmcamcorder_encode_jpeg(mapinfo1.data, dest.width, dest.height,
pixtype_main, dest.length, capture_quality,
(void **)&internal_main_data, &internal_main_length);
if (!ret) {
- _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed");
+ MMCAM_LOG_ERROR("_mmcamcorder_encode_jpeg failed");
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
dest.length = internal_main_length;
dest.format = MM_PIXEL_FORMAT_ENCODED;
- _mmcam_dbg_log("Done Internal Encode - data %p, length %d", dest.data, dest.length);
+ MMCAM_LOG_INFO("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_LOG_INFO("not encoded format, skip exif related sequence");
goto _CAPTURE_CB_EXIF_DONE;
}
} else { /* load from jpeg buffer dest.data */
ret = mm_exif_load_exif_info(&(hcamcorder->exif_info), dest.data, dest.length);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Failed to load exif_info [%x], try to create EXIF", ret);
+ MMCAM_LOG_ERROR("Failed to load exif_info [%x], try to create EXIF", ret);
provide_exif = FALSE;
ret = mm_exif_create_exif_info(&(hcamcorder->exif_info));
}
}
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Failed to create exif_info [%x], but keep going...", ret);
+ MMCAM_LOG_ERROR("Failed to create exif_info [%x], but keep going...", ret);
} else {
/* add basic exif info */
if (!provide_exif) {
- _mmcam_dbg_log("add basic exif info");
+ MMCAM_LOG_INFO("add basic exif info");
ret = __mmcamcorder_set_exif_basic_info((MMHandleType)hcamcorder, dest.width, dest.height);
} else {
- _mmcam_dbg_log("update exif info");
+ MMCAM_LOG_INFO("update exif info");
ret = __mmcamcorder_update_exif_info((MMHandleType)hcamcorder, dest.data, dest.length);
}
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_warn("Failed set_exif_basic_info [%x], but keep going...", ret);
+ MMCAM_LOG_WARNING("Failed set_exif_basic_info [%x], but keep going...", ret);
ret = MM_ERROR_NONE;
}
}
/* 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);
- _mmcam_dbg_log("set EXIF raw data %p, size %d", exif_raw_data, hcamcorder->exif_info->size);
+ mm_attrs_set_data(attrs, attr_index_for_exif, exif_raw_data, hcamcorder->exif_info->size);
+ MMCAM_LOG_INFO("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);
+ MMCAM_LOG_WARNING("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);
+ MMCAM_LOG_WARNING("failed to create EXIF. set EXIF as NULL");
+ 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);
mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
MMCAM_IMAGE_ENCODER, &codectype,
NULL);
- _mmcam_dbg_log("codectype %d", codectype);
+ MMCAM_LOG_INFO("codectype %d", codectype);
switch (codectype) {
case MM_IMAGE_CODEC_JPEG:
case MM_IMAGE_CODEC_JPEG_SRW:
ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb, provide_exif);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Error on setting extra data to jpeg");
+ MMCAM_LOG_ERROR("Error on setting extra data to jpeg");
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, ret);
goto error;
}
break;
default:
- _mmcam_dbg_err("The codectype is not supported. (%d)", codectype);
+ MMCAM_LOG_ERROR("The codectype is not supported. (%d)", codectype);
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
goto error;
}
_MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(hcamcorder);
if (hcamcorder->vcapture_cb) {
- _mmcam_dbg_log("APPLICATION CALLBACK START");
+ MMCAM_LOG_INFO("APPLICATION CALLBACK START");
if (thumb.data)
ret = hcamcorder->vcapture_cb(&dest, &thumb, hcamcorder->vcapture_cb_param);
else
ret = hcamcorder->vcapture_cb(&dest, NULL, hcamcorder->vcapture_cb_param);
- _mmcam_dbg_log("APPLICATION CALLBACK END");
+ MMCAM_LOG_INFO("APPLICATION CALLBACK END");
} else {
- _mmcam_dbg_err("Capture callback is NULL.");
+ MMCAM_LOG_ERROR("Capture callback is NULL.");
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
_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 */
if (dest.data && compare_data &&
dest.data != compare_data) {
- _mmcam_dbg_log("release internal allocated data %p", dest.data);
+ MMCAM_LOG_INFO("release internal allocated data %p", dest.data);
free(dest.data);
dest.data = NULL;
dest.length = 0;
}
if (internal_main_data) {
- _mmcam_dbg_log("release internal main data %p", internal_main_data);
+ MMCAM_LOG_INFO("release internal main data %p", internal_main_data);
free(internal_main_data);
internal_main_data = NULL;
}
if (internal_thumb_data) {
- _mmcam_dbg_log("release internal thumb data %p", internal_thumb_data);
+ MMCAM_LOG_INFO("release internal thumb data %p", internal_thumb_data);
free(internal_thumb_data);
internal_thumb_data = NULL;
}
g_mutex_lock(&hcamcorder->task_thread_lock);
if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) {
- _mmcam_dbg_log("send signal for capture in recording");
+ MMCAM_LOG_INFO("send signal for capture in recording");
g_cond_signal(&hcamcorder->task_thread_cond);
} else {
- _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state);
+ MMCAM_LOG_WARNING("unexpected task thread state : %d", hcamcorder->task_thread_state);
}
g_mutex_unlock(&hcamcorder->task_thread_lock);
_MMCAMCORDER_CMD_SIGNAL(hcamcorder);
}
- _mmcam_dbg_err("END");
+ MMCAM_LOG_ERROR("END");
return;
}
+static void __mmcamcorder_extra_preview_stream_cb(GstElement *element, int stream_id, GstSample *sample, gpointer u_data)
+{
+ if (!sample) {
+ MMCAM_LOG_ERROR("NULL sample for extra preview[id:%d]", stream_id);
+ return;
+ }
+
+ /* no need to check return value here */
+ _mmcamcorder_invoke_video_stream_cb((MMHandleType)u_data, sample, TRUE, stream_id);
+
+ gst_sample_unref(sample);
+}
+
+
gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
mmf_return_val_if_fail(sc && sc->element, FALSE);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
/* FIXME. How could you get a thumbnail? */
__mmcamcorder_image_capture_cb(fakesink, gst_sample_new(buffer, gst_pad_get_current_caps(pad), NULL, NULL), NULL, NULL, u_data);
int ret = MM_ERROR_NONE;
mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ORIENTATION, &value, NULL);
- _mmcam_dbg_log("get orientation [%d]", value);
+ MMCAM_LOG_INFO("get orientation [%d]", value);
if (value == 0)
value = MM_EXIF_ORIENTATION;
char *make = strdup(MM_MAKER_NAME);
if (make) {
- _mmcam_dbg_log("maker [%s]", make);
+ MMCAM_LOG_INFO("maker [%s]", make);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MAKE,
EXIF_FORMAT_ASCII, strlen(make)+1, (const char *)make);
free(make);
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
} else {
- _mmcam_dbg_err("strdup failed [%s]", MM_MAKER_NAME);
+ MMCAM_LOG_ERROR("strdup failed [%s]", MM_MAKER_NAME);
}
exit:
mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
if (hcamcorder == NULL || ed == NULL) {
- _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed);
+ MMCAM_LOG_ERROR("NULL parameter %p,%p", hcamcorder, ed);
return NULL;
}
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE, EXIF_FORMAT_ASCII,
strlen(hcamcorder->software_version)+1, (const char *)hcamcorder->software_version);
- _mmcam_dbg_log("set software_version[%s] ret[0x%x]",
+ MMCAM_LOG_INFO("set software_version[%s] ret[0x%x]",
hcamcorder->software_version, ret);
} else {
- _mmcam_dbg_err("model_name is NULL");
+ MMCAM_LOG_ERROR("model_name is NULL");
}
return ed;
mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
if (hcamcorder == NULL || ed == NULL) {
- _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed);
+ MMCAM_LOG_ERROR("NULL parameter %p,%p", hcamcorder, ed);
return NULL;
}
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MODEL, EXIF_FORMAT_ASCII,
strlen(hcamcorder->model_name)+1, (const char *)hcamcorder->model_name);
- _mmcam_dbg_err("set model name[%s] ret[0x%x]",
+ MMCAM_LOG_ERROR("set model name[%s] ret[0x%x]",
hcamcorder->model_name, ret);
} else {
- _mmcam_dbg_err("model_name is NULL");
+ MMCAM_LOG_ERROR("model_name is NULL");
}
return ed;
if (ret == MM_ERROR_NONE && gps_enable) {
ExifByte GpsVersion[4] = {2, 2, 0, 0};
- _mmcam_dbg_log("Tag for GPS is ENABLED.");
+ MMCAM_LOG_INFO("Tag for GPS is ENABLED.");
ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_VERSION_ID,
EXIF_FORMAT_BYTE, 4, (const char *)&GpsVersion);
MMCAM_TAG_LONGITUDE, &longitude,
MMCAM_TAG_ALTITUDE, &altitude, NULL);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to get gps info [%x][%s]", ret, err_name);
+ MMCAM_LOG_ERROR("failed to get gps info [%x][%s]", ret, err_name);
SAFE_FREE(err_name);
goto exit;
}
- _mmcam_dbg_log("latitude [%f]", latitude);
+ MMCAM_LOG_INFO("latitude [%f]", latitude);
if (latitude != INVALID_GPS_VALUE) {
unsigned char *b = NULL;
unsigned int deg;
min = (unsigned int)((latitude-deg) * 60);
sec = (unsigned int)(((latitude-deg) * 3600) - min * 60);
- _mmcam_dbg_log("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec);
+ MMCAM_LOG_INFO("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec);
b = malloc(3 * sizeof(ExifRational));
if (b) {
rData.numerator = deg;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE);
} else {
- _mmcam_dbg_warn("malloc failed");
+ MMCAM_LOG_WARNING("malloc failed");
}
}
- _mmcam_dbg_log("longitude [%f]", longitude);
+ MMCAM_LOG_INFO("longitude [%f]", longitude);
if (longitude != INVALID_GPS_VALUE) {
unsigned char *b = NULL;
unsigned int deg;
min = (unsigned int)((longitude-deg) * 60);
sec = (unsigned int)(((longitude-deg) * 3600) - min * 60);
- _mmcam_dbg_log("longitude deg[%d], min[%d], sec[%d]", deg, min, sec);
+ MMCAM_LOG_INFO("longitude deg[%d], min[%d], sec[%d]", deg, min, sec);
b = malloc(3 * sizeof(ExifRational));
if (b) {
rData.numerator = deg;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE);
} else {
- _mmcam_dbg_warn("malloc failed");
+ MMCAM_LOG_WARNING("malloc failed");
}
}
- _mmcam_dbg_log("f_altitude [%f]", altitude);
+ MMCAM_LOG_INFO("f_altitude [%f]", altitude);
if (altitude != INVALID_GPS_VALUE) {
ExifByte alt_ref = 0;
unsigned char *b = NULL;
ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE_REF,
EXIF_FORMAT_BYTE, 1, (const char *)&alt_ref);
if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF);
+ MMCAM_LOG_ERROR("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF);
if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
free(b);
b = NULL;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_GPS_ALTITUDE);
} else {
- _mmcam_dbg_warn("malloc failed");
+ MMCAM_LOG_WARNING("malloc failed");
}
}
{
double gps_timestamp = INVALID_GPS_VALUE;
mm_camcorder_get_attributes(handle, NULL, "tag-gps-time-stamp", &gps_timestamp, NULL);
- _mmcam_dbg_log("Gps timestamp [%f]", gps_timestamp);
+ MMCAM_LOG_INFO("Gps timestamp [%f]", gps_timestamp);
if (gps_timestamp > 0.0) {
unsigned char *b = NULL;
unsigned int hour;
min = (unsigned int)((gps_timestamp - 3600 * hour) / 60);
microsec = (unsigned int)(((double)((double)gps_timestamp -(double)(3600 * hour)) -(double)(60 * min)) * 1000000);
- _mmcam_dbg_log("Gps timestamp hour[%d], min[%d], microsec[%d]", hour, min, microsec);
+ MMCAM_LOG_INFO("Gps timestamp hour[%d], min[%d], microsec[%d]", hour, min, microsec);
b = malloc(3 * sizeof(ExifRational));
if (b) {
rData.numerator = hour;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_GPS_TIME_STAMP);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
}
}
mm_camcorder_get_attributes(handle, NULL, "tag-gps-date-stamp", &date_stamp, &date_stamp_len, NULL);
if (date_stamp) {
- _mmcam_dbg_log("Date stamp [%s]", date_stamp);
+ MMCAM_LOG_INFO("Date stamp [%s]", date_stamp);
/* cause it should include NULL char */
ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_DATE_STAMP,
mm_camcorder_get_attributes(handle, NULL, "tag-gps-processing-method", &processing_method, &processing_method_len, NULL);
if (processing_method) {
- _mmcam_dbg_log("Processing method [%s]", processing_method);
+ MMCAM_LOG_INFO("Processing method [%s]", processing_method);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_PROCESSING_METHOD,
EXIF_FORMAT_UNDEFINED, processing_method_len, (const char *)processing_method);
}
}
} else {
- _mmcam_dbg_log("Tag for GPS is DISABLED.");
+ MMCAM_LOG_INFO("Tag for GPS is DISABLED.");
}
exit:
/*ed = mm_exif_get_exif_from_info(hcamcorder->exif_info);*/
if (ed == NULL) {
- _mmcam_dbg_err("get exif data error!!");
+ MMCAM_LOG_ERROR("get exif data error!!");
return MM_ERROR_INVALID_HANDLE;
}
__mmcamcorder_update_exif_gps(handle, ed);
ret = mm_exif_set_exif_to_info(hcamcorder->exif_info, ed);
if (ret != MM_ERROR_NONE)
- _mmcam_dbg_err("mm_exif_set_exif_to_info err!! [%x]", ret);
+ MMCAM_LOG_ERROR("mm_exif_set_exif_to_info err!! [%x]", ret);
exif_data_unref(ed);
ed = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
CLEAR(avsys_exif_info);
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
- _mmcam_dbg_err("Can't cast Video source into camera control. Skip camera control values...");
+ MMCAM_LOG_ERROR("Can't cast Video source into camera control. Skip camera control values...");
} else {
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
/* get device information */
/* get ExifData from exif info */
ed = mm_exif_get_exif_from_info(hcamcorder->exif_info);
if (ed == NULL) {
- _mmcam_dbg_err("get exif data error!!");
+ MMCAM_LOG_ERROR("get exif data error!!");
return MM_ERROR_INVALID_HANDLE;
}
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_X_DIMENSION);
- _mmcam_dbg_log("width[%d]", value);
+ MMCAM_LOG_INFO("width[%d]", value);
/*2. EXIF_TAG_IMAGE_LENGTH*/ /*EXIF_TAG_PIXEL_Y_DIMENSION*/
value = image_height;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_Y_DIMENSION);
- _mmcam_dbg_log("height[%d]", value);
+ MMCAM_LOG_INFO("height[%d]", value);
/*4. EXIF_TAG_DATE_TIME */
/*13. EXIF_TAG_DATE_TIME_DIGITIZED*/
{
- unsigned char *b;
+ gchar *b = NULL;
time_t t;
struct tm tm;
- b = malloc(20 * sizeof(unsigned char));
- if (b == NULL) {
- _mmcam_dbg_err("failed to alloc b");
- ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
- EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME);
- }
-
- memset(b, '\0', 20);
-
t = time(NULL);
tzset();
localtime_r(&t, &tm);
- snprintf((char *)b, 20, "%04i:%02i:%02i %02i:%02i:%02i",
+ b = g_strdup_printf("%04i:%02i:%02i %02i:%02i:%02i",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, 20, (const char *)b);
if (ret != MM_ERROR_NONE) {
if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY)
- free(b);
+ g_free(b);
EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME);
}
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, 20, (const char *)b);
if (ret != MM_ERROR_NONE) {
if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY)
- free(b);
+ g_free(b);
EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_ORIGINAL);
}
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, 20, (const char *)b);
if (ret != MM_ERROR_NONE) {
if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY)
- free(b);
+ g_free(b);
EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_DIGITIZED);
}
- free(b);
+ g_free(b);
}
/*5. EXIF_TAG_MAKE */
if (str_value && str_val_len > 0) {
char *description = strdup(str_value);
- _mmcam_dbg_log("desctiption [%s]", str_value);
+ MMCAM_LOG_INFO("description [%s]", str_value);
if (description) {
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION,
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_DESCRIPTION);
} else {
- _mmcam_dbg_err("strdup failed for [%s]", str_value);
+ MMCAM_LOG_ERROR("strdup failed for [%s]", str_value);
}
} else {
- _mmcam_dbg_warn("failed to get description");
+ MMCAM_LOG_WARNING("failed to get description");
}
/*7. EXIF_TAG_SOFTWARE*/
unsigned int len = 0;
len = snprintf(software, sizeof(software), "%x.%x ", avsys_exif_info.software_used>>8, (avsys_exif_info.software_used & 0xff));
- _mmcam_dbg_log("software [%s], len [%d]", software, len);
+ MMCAM_LOG_INFO("software [%s], len [%d]", software, len);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE,
EXIF_FORMAT_ASCII, len, (const char *)software);
if (ret != MM_ERROR_NONE) {
/*FIXME : get user comment from real user */
user_comment = strdup(MM_USER_COMMENT);
if (user_comment) {
- _mmcam_dbg_log("user_comment=%s", user_comment);
+ MMCAM_LOG_INFO("user_comment=%s", user_comment);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_USER_COMMENT,
EXIF_FORMAT_ASCII, strlen(user_comment), (const char *)user_comment);
free(user_comment);
/*10. EXIF_TAG_COMPONENTS_CONFIGURATION */
if (control != NULL) {
config = avsys_exif_info.component_configuration;
- _mmcam_dbg_log("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ", config);
+ MMCAM_LOG_INFO("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ", config);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION,
EXIF_FORMAT_UNDEFINED, 4, (const char *)&config);
if (ret != MM_ERROR_NONE)
unsigned char *b = NULL;
ExifRational rData;
- _mmcam_dbg_log("EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]",
avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator);
b = malloc(sizeof(ExifRational));
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_TIME);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("Skip set EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("Skip set EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]",
avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator);
}
unsigned char *b = NULL;
ExifRational rData;
- _mmcam_dbg_log("EXIF_TAG_FNUMBER numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("EXIF_TAG_FNUMBER numerator [%d], denominator [%d]",
avsys_exif_info.aperture_f_num_numerator, avsys_exif_info.aperture_f_num_denominator);
b = malloc(sizeof(ExifRational));
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_FNUMBER);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("Skip set EXIF_TAG_FNUMBER numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("Skip set EXIF_TAG_FNUMBER numerator [%d], denominator [%d]",
avsys_exif_info.aperture_f_num_numerator, avsys_exif_info.aperture_f_num_denominator);
}
/*17. EXIF_TAG_ISO_SPEED_RATINGS*/
if (avsys_exif_info.iso) {
- _mmcam_dbg_log("EXIF_TAG_ISO_SPEED_RATINGS [%d]", avsys_exif_info.iso);
+ MMCAM_LOG_INFO("EXIF_TAG_ISO_SPEED_RATINGS [%d]", avsys_exif_info.iso);
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.iso);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_ISO_SPEED_RATINGS,
EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
unsigned char *b = NULL;
ExifSRational rsData;
- _mmcam_dbg_log("EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]",
avsys_exif_info.shutter_speed_numerator, avsys_exif_info.shutter_speed_denominator);
b = malloc(sizeof(ExifSRational));
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_SHUTTER_SPEED_VALUE);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("Skip set EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("Skip set EXIF_TAG_SHUTTER_SPEED_VALUE numerator [%d], denominator [%d]",
avsys_exif_info.shutter_speed_numerator, avsys_exif_info.shutter_speed_denominator);
}
unsigned char *b = NULL;
ExifRational rData;
- _mmcam_dbg_log("EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX);
+ MMCAM_LOG_INFO("EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX);
b = malloc(sizeof(ExifRational));
if (b) {
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_APERTURE_VALUE);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("Skip set EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX);
+ MMCAM_LOG_INFO("Skip set EXIF_TAG_APERTURE_VALUE [%d]", avsys_exif_info.aperture_in_APEX);
}
/*20. EXIF_TAG_BRIGHTNESS_VALUE*/
unsigned char *b = NULL;
ExifSRational rsData;
- _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominator [%d]",
avsys_exif_info.brigtness_numerator, avsys_exif_info.brightness_denominator);
b = malloc(sizeof(ExifSRational));
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_BRIGHTNESS_VALUE);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("Skip set EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominatorr [%d]",
+ MMCAM_LOG_INFO("Skip set EXIF_TAG_BRIGHTNESS_VALUE numerator [%d], denominatorr [%d]",
avsys_exif_info.brigtness_numerator, avsys_exif_info.brightness_denominator);
}
unsigned char *b = NULL;
ExifSRational rsData;
- _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE %d, default %d, step denominator %d",
+ MMCAM_LOG_INFO("EXIF_TAG_BRIGHTNESS_VALUE %d, default %d, step denominator %d",
value, hcamcorder->brightness_default, hcamcorder->brightness_step_denominator);
b = malloc(sizeof(ExifSRational));
if (hcamcorder->brightness_step_denominator != 0) {
rsData.denominator = hcamcorder->brightness_step_denominator;
} else {
- _mmcam_dbg_warn("brightness_step_denominator is ZERO, so set 1");
+ MMCAM_LOG_WARNING("brightness_step_denominator is ZERO, so set 1");
rsData.denominator = 1;
}
exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_BIAS_VALUE);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("failed to get MMCAM_FILTER_BRIGHTNESS [%x]", ret);
+ MMCAM_LOG_INFO("failed to get MMCAM_FILTER_BRIGHTNESS [%x]", ret);
}
/*22 EXIF_TAG_MAX_APERTURE_VALUE*/
unsigned char *b = NULL;
ExifRational rData;
- _mmcam_dbg_log("EXIF_TAG_MAX_APERTURE_VALUE [%d]", avsys_exif_info.max_lens_aperture_in_APEX);
+ MMCAM_LOG_INFO("EXIF_TAG_MAX_APERTURE_VALUE [%d]", avsys_exif_info.max_lens_aperture_in_APEX);
b = malloc(sizeof(ExifRational));
if (b) {
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_MAX_APERTURE_VALUE);
} else {
- _mmcam_dbg_warn("failed to alloc for MAX aperture value");
+ MMCAM_LOG_WARNING("failed to alloc for MAX aperture value");
}
}
*/
/*23. EXIF_TAG_SUBJECT_DISTANCE*/
- /* defualt : none */
+ /* default : none */
/*24. EXIF_TAG_METERING_MODE */
if (control != NULL) {
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.metering_mode);
- _mmcam_dbg_log("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode);
+ MMCAM_LOG_INFO("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_METERING_MODE,
EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE)
/*26. EXIF_TAG_FLASH*/
if (control != NULL) {
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.flash);
- _mmcam_dbg_log("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash);
+ MMCAM_LOG_INFO("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH,
EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE)
unsigned char *b = NULL;
ExifRational rData;
- _mmcam_dbg_log("EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]",
avsys_exif_info.focal_len_numerator, avsys_exif_info.focal_len_denominator);
b = malloc(sizeof(ExifRational));
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_FOCAL_LENGTH);
} else {
- _mmcam_dbg_warn("malloc failed.");
+ MMCAM_LOG_WARNING("malloc failed.");
}
} else {
- _mmcam_dbg_log("Skip set EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]",
+ MMCAM_LOG_INFO("Skip set EXIF_TAG_FOCAL_LENGTH numerator [%d], denominator [%d]",
avsys_exif_info.focal_len_numerator, avsys_exif_info.focal_len_denominator);
}
ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_WB, &value, NULL);
if (ret == MM_ERROR_NONE) {
int set_value = 0;
- _mmcam_dbg_log("WHITE BALANCE [%d]", value);
+ MMCAM_LOG_INFO("WHITE BALANCE [%d]", value);
if (value == MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC)
set_value = 0;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_WHITE_BALANCE);
} else {
- _mmcam_dbg_warn("failed to get white balance [%x]", ret);
+ MMCAM_LOG_WARNING("failed to get white balance [%x]", ret);
}
/*33. EXIF_TAG_DIGITAL_ZOOM_RATIO*/
/*
ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_DIGITAL_ZOOM, &value, NULL);
if (ret == MM_ERROR_NONE) {
- _mmcam_dbg_log("DIGITAL ZOOM [%d]", value);
+ MMCAM_LOG_INFO("DIGITAL ZOOM [%d]", value);
exif_set_long(&elong[cntl], exif_data_get_byte_order(ed), value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO,
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_DIGITAL_ZOOM_RATIO);
} else {
- _mmcam_dbg_warn("failed to get digital zoom [%x]", ret);
+ MMCAM_LOG_WARNING("failed to get digital zoom [%x]", ret);
}
*/
ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SCENE_MODE, &value, NULL);
if (ret == MM_ERROR_NONE) {
- _mmcam_dbg_log("Scene mode(program mode) [%d]", value);
+ MMCAM_LOG_INFO("Scene mode(program mode) [%d]", value);
switch (value) {
case MM_CAMCORDER_SCENE_MODE_NORMAL:
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_SCENE_CAPTURE_TYPE);
} else {
- _mmcam_dbg_warn("failed to get scene mode [%x]", ret);
+ MMCAM_LOG_WARNING("failed to get scene mode [%x]", ret);
}
}
if (irange != NULL) {
mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_CONTRAST, &value, NULL);
- _mmcam_dbg_log("CONTRAST currentt [%d], default [%d]", value, irange->default_value);
+ MMCAM_LOG_INFO("CONTRAST current [%d], default [%d]", value, irange->default_value);
if (value == irange->default_value)
level = MM_VALUE_NORMAL;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_CONTRAST);
} else {
- _mmcam_dbg_warn("failed to get range of contrast");
+ MMCAM_LOG_WARNING("failed to get range of contrast");
}
}
if (irange != NULL) {
mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SATURATION, &value, NULL);
- _mmcam_dbg_log("SATURATION current [%d], default [%d]", value, irange->default_value);
+ MMCAM_LOG_INFO("SATURATION current [%d], default [%d]", value, irange->default_value);
if (value == irange->default_value)
level = MM_VALUE_NORMAL;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_SATURATION);
} else {
- _mmcam_dbg_warn("failed to get range of saturation");
+ MMCAM_LOG_WARNING("failed to get range of saturation");
}
}
if (irange != NULL) {
mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_SHARPNESS, &value, NULL);
- _mmcam_dbg_log("SHARPNESS current [%d], default [%d]", value, irange->default_value);
+ MMCAM_LOG_INFO("SHARPNESS current [%d], default [%d]", value, irange->default_value);
if (value == irange->default_value)
level = MM_VALUE_NORMAL;
if (ret != MM_ERROR_NONE)
EXIF_SET_ERR(ret, EXIF_TAG_SHARPNESS);
} else {
- _mmcam_dbg_warn("failed to get range of sharpness");
+ MMCAM_LOG_WARNING("failed to get range of sharpness");
}
}
/*40. EXIF_TAG_SUBJECT_DISTANCE_RANGE*/
/*FIXME*/
value = MM_SUBJECT_DISTANCE_RANGE;
- _mmcam_dbg_log("DISTANCE_RANGE [%d]", value);
+ MMCAM_LOG_INFO("DISTANCE_RANGE [%d]", value);
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE_RANGE,
EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
/* GPS information */
__mmcamcorder_update_exif_gps(handle, ed);
- _mmcam_dbg_log("");
+ MMCAM_LOG_INFO("");
ret = mm_exif_set_exif_to_info(hcamcorder->exif_info, ed);
if (ret != MM_ERROR_NONE)
- _mmcam_dbg_err("mm_exif_set_exif_to_info err!! [%x]", ret);
+ MMCAM_LOG_ERROR("mm_exif_set_exif_to_info err!! [%x]", ret);
exit:
- _mmcam_dbg_log("finished!! [%x]", ret);
+ MMCAM_LOG_INFO("finished!! [%x]", ret);
if (ed)
exif_data_unref(ed);
mmf_return_if_fail(hcamcorder && hcamcorder->sub_context && hcamcorder->sub_context->info_image);
- _mmcam_dbg_log("START");
+ MMCAM_LOG_INFO("START");
info = hcamcorder->sub_context->info_image;
vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status));
- _mmcam_dbg_log("DONE : sound status %d", info->sound_status);
+ MMCAM_LOG_INFO("DONE : sound status %d", info->sound_status);
return;
}
+
+
+int _mmcamcorder_set_extra_preview_stream_format(MMHandleType camcorder, int stream_id, int pixel_format, int width, int height, int fps)
+{
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)camcorder;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ GstCameraControl *control = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->support_extra_preview, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(pixel_format > MM_PIXEL_FORMAT_INVALID && pixel_format < MM_PIXEL_FORMAT_NUM,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(width > 0 && height > 0 && fps >= 0, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(camcorder, ¤t_state);
+
+ MMCAM_LOG_INFO("state[%d] stream_id[%d],fmt[%d],res[%dx%d],fps[%d]",
+ current_state, stream_id, pixel_format, width, height, fps);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(camcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_set_extra_preview_stream_format(control,
+ stream_id, _mmcamcorder_get_camera_control_image_format(pixel_format), width, height, fps)) {
+ MMCAM_LOG_ERROR("camera control failed");
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+ } else {
+ MMCAM_LOG_INFO("It will be set when start preview");
+ hcamcorder->extra_preview_format[stream_id].need_to_set_format = TRUE;
+ }
+
+ hcamcorder->extra_preview_format[stream_id].pixel_format = pixel_format;
+ hcamcorder->extra_preview_format[stream_id].width = width;
+ hcamcorder->extra_preview_format[stream_id].height = height;
+ hcamcorder->extra_preview_format[stream_id].fps = fps;
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_get_extra_preview_stream_format(MMHandleType camcorder, int stream_id, int *pixel_format, int *width, int *height, int *fps)
+{
+ int _width = 0;
+ int _height = 0;
+ int _fps = 0;
+ GstCameraControlImageFormat _img_fmt = GST_CAMERA_CONTROL_IMAGE_FORMAT_NV12;
+ GstCameraControl *control = NULL;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)camcorder;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->support_extra_preview, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(pixel_format && width && height && fps, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(camcorder, ¤t_state);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(camcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_get_extra_preview_stream_format(control,
+ stream_id, &_img_fmt, &_width, &_height, &_fps)) {
+ MMCAM_LOG_ERROR("extra preview stream format get failed");
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+
+ *pixel_format = _mmcamcorder_get_pixel_format2(_img_fmt);
+ *width = _width;
+ *height = _height;
+ *fps = _fps;
+ } else {
+ *pixel_format = hcamcorder->extra_preview_format[stream_id].pixel_format;
+ *width = hcamcorder->extra_preview_format[stream_id].width;
+ *height = hcamcorder->extra_preview_format[stream_id].height;
+ *fps = hcamcorder->extra_preview_format[stream_id].fps;
+ }
+
+ MMCAM_LOG_INFO("get result[fmt:%d(%d),res:%dx%d,fps:%d][state:%d]",
+ *pixel_format, _img_fmt, *width, *height, *fps, current_state);
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_set_extra_preview_bitrate(MMHandleType camcorder, int stream_id, int bitrate)
+{
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)camcorder;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ GstCameraControl *control = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->support_extra_preview, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(bitrate > 0, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(camcorder, ¤t_state);
+
+ MMCAM_LOG_INFO("state[%d] stream[%d], bitrate[%d]", current_state, stream_id, bitrate);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(camcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_set_extra_preview_bitrate(control, stream_id, bitrate)) {
+ MMCAM_LOG_ERROR("set bitrate[%d] for stream[%d] failed", bitrate, stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+ } else {
+ MMCAM_LOG_INFO("It will be set when start preview");
+ hcamcorder->extra_preview_format[stream_id].need_to_set_bitrate = TRUE;
+ }
+
+ hcamcorder->extra_preview_format[stream_id].bitrate = bitrate;
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_get_extra_preview_bitrate(MMHandleType camcorder, int stream_id, int *bitrate)
+{
+ int _bitrate = 0;
+ GstCameraControl *control = NULL;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)camcorder;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->support_extra_preview, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(bitrate, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(camcorder, ¤t_state);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(camcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_get_extra_preview_bitrate(control, stream_id, &_bitrate)) {
+ MMCAM_LOG_ERROR("get bitrate for stream[%d] failed", stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+
+ *bitrate = _bitrate;
+ } else {
+ *bitrate = hcamcorder->extra_preview_format[stream_id].bitrate;
+ }
+
+ MMCAM_LOG_INFO("get bitrate[%d] for stream[%d][state:%d]",
+ *bitrate, stream_id, current_state);
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_set_extra_preview_gop_interval(MMHandleType camcorder, int stream_id, int interval)
+{
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)camcorder;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ GstCameraControl *control = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->support_extra_preview, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(camcorder, ¤t_state);
+
+ MMCAM_LOG_INFO("state[%d] stream[%d], interval[%d]", current_state, stream_id, interval);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(camcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_set_extra_preview_gop_interval(control, stream_id, interval)) {
+ MMCAM_LOG_ERROR("set GOP interval[%d] for stream[%d] failed", interval, stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+ } else {
+ MMCAM_LOG_INFO("It will be set when start preview");
+ hcamcorder->extra_preview_format[stream_id].need_to_set_gop_interval = TRUE;
+ }
+
+ hcamcorder->extra_preview_format[stream_id].gop_interval = interval;
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_get_extra_preview_gop_interval(MMHandleType camcorder, int stream_id, int *interval)
+{
+ int _interval = 0;
+ GstCameraControl *control = NULL;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)camcorder;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->support_extra_preview, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_NUM,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(interval, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(camcorder, ¤t_state);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(camcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_get_extra_preview_gop_interval(control, stream_id, &_interval)) {
+ MMCAM_LOG_ERROR("get GOP interval for stream[%d] failed", stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+
+ *interval = _interval;
+ } else {
+ *interval = hcamcorder->extra_preview_format[stream_id].gop_interval;
+ }
+
+ MMCAM_LOG_INFO("get GOP interval[%d] for stream[%d][state:%d]",
+ *interval, stream_id, current_state);
+
+ return MM_ERROR_NONE;
+}