int ret = 0; \
ret = expr; \
if (ret != MM_ERROR_NONE) {\
- printf("[%s:%d] error code : %x \n", __func__, __LINE__, ret); \
+ g_print("[%s:%d] error code : %x \n", __func__, __LINE__, ret); \
return; \
}\
} while(0)
} while(0)
#ifndef SAFE_FREE
-#define SAFE_FREE(x) if(x) {g_free(x); x = NULL;}
+#define SAFE_FREE(x) if(x) {free(x); x = NULL;}
#endif
+#ifndef SAFE_G_FREE
+#define SAFE_G_FREE(x) if(x) {g_free(x); x = NULL;}
+#endif
GTimeVal previous;
GTimeVal current;
static int camcordertest_audio_stream_cb(MMCamcorderAudioStreamDataType *stream, void *user_param)
{
audio_stream_cb_cnt++;
- printf("audio_stream cb is called (stream:%p, data:%p, format:%d, channel:%d, volume_dB:%f, length:%d, timestamp:%d)\n",
+ g_print("audio_stream cb is called (stream:%p, data:%p, format:%d, channel:%d, volume_dB:%f, length:%d, timestamp:%d)\n",
stream, stream->data, stream->format, stream->channel, stream->volume_dB, stream->length, stream->timestamp);
return TRUE;
{
video_stream_cb_cnt++;
- printf("VIDEO STREAM CALLBACK total length :%u, size %dx%d\n", stream->length_total, stream->width, stream->height);
+ g_print("VIDEO STREAM CALLBACK total length :%u, size %dx%d\n", stream->length_total, stream->width, stream->height);
return TRUE;
}
FILE *fp = NULL;
if (!path || !data || size <= 0) {
- printf("ERROR %p %p %d\n", path, data, size);
+ g_print("ERROR %p %p %d\n", path, data, size);
return;
}
fp = fopen(path, "w");
if (fp == NULL) {
- printf("open error! [%s], errno %d\n", path, errno);
+ g_print("open error! [%s], errno %d\n", path, errno);
return;
} else {
- printf("open success [%s]\n", path);
+ g_print("open success [%s]\n", path);
if (fwrite(data, size, 1, fp) != 1) {
- printf("write error! errno %d\n", errno);
+ g_print("write error! errno %d\n", errno);
} else {
- printf("write success [%s]\n", path);
+ g_print("write success [%s]\n", path);
}
fclose(fp);
FILE *fp = NULL;
if (!path || !data || size <= 0) {
- printf("ERROR %p %p %d\n", path, data, size);
+ g_print("ERROR %p %p %d\n", path, data, size);
return;
}
fp = fopen(path, "w");
if (fp == NULL) {
- printf("open error! [%s], errno %d\n", path, errno);
+ g_print("open error! [%s], errno %d\n", path, errno);
return;
} else {
- printf("open success [%s]\n", path);
+ g_print("open success [%s]\n", path);
if (fwrite(data, size, 1, fp) != 1) {
- printf("write error! errno %d\n", errno);
+ g_print("write error! errno %d\n", errno);
} else {
- printf("write success [%s]\n", path);
+ g_print("write success [%s]\n", path);
}
fclose(fp);
if (nret) {
_file_write(m_filename, dst, dst_size);
} else {
- printf("Failed to encode YUV(%d) -> JPEG. \n", main->format);
+ g_print("Failed to encode YUV(%d) -> JPEG. \n", main->format);
}
-
- free(dst);
- dst = NULL;
+ SAFE_FREE(dst);
} else if (!hcamcorder->isMultishot) {
- printf("MM_PIXEL_FORMAT_ENCODED main->data=%p main->length=%d, main->width=%d, main->heigtht=%d \n",
+ g_print("MM_PIXEL_FORMAT_ENCODED main->data=%p main->length=%d, main->width=%d, main->heigtht=%d \n",
main->data, main->length, main->width, main->height);
/* main image */
if (scrnl != NULL) {
_file_write2(IMAGE_CAPTURE_SCREENNAIL_PATH, scrnl->data, scrnl->length);
} else {
- printf( "Screennail buffer is NULL.\n" );
+ g_print( "Screennail buffer is NULL.\n" );
}
/* EXIF data */
if (err < 0) {
warn_msg_t("Multishot mm_camcorder_capture_start = %x", err);
}
-
return FALSE;
}
NULL);
if (err < 0) {
err_msg_t("camcordertest_set_attr_xypair : Error(%s:%x)!!", err_attr_name, err);
- SAFE_FREE (err_attr_name);
+ SAFE_FREE(err_attr_name);
return FALSE;
}
//success
+ SAFE_FREE(err_attr_name);
return TRUE;
}
if(hcamcorder->isMultishot) {
int interval = 0;
flush_stdin();
- printf("\ninput interval(ms) \n");
+ g_print("\ninput interval(ms) \n");
err = scanf("%d", &interval);
if (err == EOF) {
- printf("\nscanf error : errno %d\n", errno);
+ g_print("\nscanf error : errno %d\n", errno);
interval = 300;
}
err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
NULL);
if (err != MM_ERROR_NONE) {
err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err);
- SAFE_FREE (err_attr_name);
+ SAFE_FREE(err_attr_name);
}
} else {
err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
NULL);
if (err != MM_ERROR_NONE) {
err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err);
- SAFE_FREE (err_attr_name);
+ SAFE_FREE(err_attr_name);
}
}
}
err = scanf("%d",&idx);
if (err == EOF) {
- printf("\nscanf error : errno %d\n", errno);
+ g_print("\nscanf error : errno %d\n", errno);
} else {
if( idx > 0 && idx <= width_count ) {
//Set capture size first
}
err = scanf("%d",&idx);
if (err == EOF) {
- printf("\nscanf error : errno %d\n", errno);
+ g_print("\nscanf error : errno %d\n", errno);
} else {
if( idx > 0 && idx <= width_count ) {
//Set capture size first
if( err != MM_ERROR_NONE ) {
g_print( "Failed to set touch AF area.(%x)(%s)\n", err, err_attr_name );
- free( err_attr_name );
- err_attr_name = NULL;
+ SAFE_FREE(err_attr_name);
} else {
g_print( "Succeed to set touch AF area.\n" );
}
NULL);
if (err != MM_ERROR_NONE) {
g_print("Failed to set Camcorder Motion Rate %f [err:0x%x]\n", motion_rate, err);
- free( err_attr_name );
- err_attr_name = NULL;
+ SAFE_FREE(err_attr_name);
} else {
g_print("Succeed to set Motion Rate %f\n", motion_rate);
}
hcamcorder->menu_state = MENU_STATE_MAIN;
}
- if(err_attr_name){
- free( err_attr_name );
- err_attr_name = NULL;
- }
-
g_print("\t bret : 0x%x \n", bret);
+
+ SAFE_FREE(err_attr_name);
+
+ return;
}
break;
}
- g_free(buf);
- buf = NULL;
-
+ SAFE_G_FREE(buf);
print_menu();
} else {
debug_msg_t("No read input");
void validity_print(MMCamAttrsInfo *info)
{
- printf("info(%d,%d, %d))\n", info->type, info->flag, info->validity_type);
- if (info->validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY)
- {
- printf("int array(%p, %d)\n", info->int_array.array, info->int_array.count);
- }
- else if (info->validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_RANGE)
- {
- printf("int range(%d, %d)\n", info->int_range.min, info->int_range.max);
- }
- else if (info->validity_type == MM_CAM_ATTRS_VALID_TYPE_DOUBLE_ARRAY)
- {
- printf("double array(%p, %d)\n", info->double_array.array, info->double_array.count);
- }
- else if(info->validity_type == MM_CAM_ATTRS_VALID_TYPE_DOUBLE_RANGE)
- {
- printf("double range(%f, %f)\n", info->double_range.min, info->double_range.max);
- }
- else
- {
- printf("validity none\n");
- }
- return;
+ g_print("info(%d,%d, %d))\n", info->type, info->flag, info->validity_type);
+ if (info->validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY)
+ {
+ g_print("int array(%p, %d)\n", info->int_array.array, info->int_array.count);
+ }
+ else if (info->validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_RANGE)
+ {
+ g_print("int range(%d, %d)\n", info->int_range.min, info->int_range.max);
+ }
+ else if (info->validity_type == MM_CAM_ATTRS_VALID_TYPE_DOUBLE_ARRAY)
+ {
+ g_print("double array(%p, %d)\n", info->double_array.array, info->double_array.count);
+ }
+ else if(info->validity_type == MM_CAM_ATTRS_VALID_TYPE_DOUBLE_RANGE)
+ {
+ g_print("double range(%f, %f)\n", info->double_range.min, info->double_range.max);
+ }
+ else
+ {
+ g_print("validity none\n");
+ }
+ return;
}
MMCAM_TAG_LATITUDE, 35.3036944,
MMCAM_TAG_LONGITUDE, 176.67837,
MMCAM_TAG_ALTITUDE, 190.3455,
- MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X,
+ MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_OVERLAY,
MMCAM_DISPLAY_GEOMETRY_METHOD, MM_DISPLAY_METHOD_LETTER_BOX,
MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL,
MMCAM_TAG_GPS_ENABLE, TRUE,
if (err != MM_ERROR_NONE) {
warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
- SAFE_FREE (err_attr_name);
+ SAFE_FREE(err_attr_name);
goto ERROR;
}
if (err < 0) {
warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
- SAFE_FREE (err_attr_name);
+ SAFE_FREE(err_attr_name);
goto ERROR;
}
mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcamcorder->camcorder);
#endif /* USE_AUDIO_STREAM_CB */
}
-
+ SAFE_FREE (err_attr_name);
debug_msg_t("Init DONE.");
return TRUE;