Name: libmm-camcorder
Summary: Camera and recorder library
-Version: 0.10.18
+Version: 0.10.19
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
}
if (count > 0) {
- rms = sqrt( square_sum/count );
+ rms = sqrt( (double)square_sum/(double)count );
if (depthByte == 1) {
db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_08BIT );
} else {
/* release */
for (i = 0; i < *argc; i++) {
if (argv[i]) {
- free(argv[i]);
+ g_free(argv[i]);
argv[i] = NULL;
}
}
- if (argv) {
- free(argv);
- argv = NULL;
- }
+ free(argv);
+ argv = NULL;
- if (argc) {
- free(argc);
- argc = NULL;
- }
+ free(argc);
+ argc = NULL;
return ret;
else if( *buffer_token[0] == '[' )
{
category_name = get_new_string( buffer_token[0] );
+ if (category_name == NULL) {
+ _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]);
+ continue;
+ }
count_main_category++;
count_details = 0;
free( new_int_pair_array->name );
new_int_pair_array->name = NULL;
}
- free( new_int_pair_array );
+ g_free( new_int_pair_array );
new_int_pair_array = NULL;
_mmcam_dbg_err("allocation failed");
break;
}
new_int_pair_array->value[1] = (int*)g_malloc( sizeof(int)*(count_value) );
if ( new_int_pair_array->value[1] == NULL ) {
- free( new_int_pair_array->value[0] );
+ g_free( new_int_pair_array->value[0] );
new_int_pair_array->value[0] = NULL;
if (new_int_pair_array->name) {
free( new_int_pair_array->name );
new_int_pair_array->name = NULL;
}
- free( new_int_pair_array );
+ g_free( new_int_pair_array );
new_int_pair_array = NULL;
_mmcam_dbg_err("allocation failed");
break;
*/
/* add int values */
- if ( new_element->count_int > 0 ) {
+ if ( new_element->count_int > 0 && new_element->count_int <= 30 ) {
new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
if ( new_element->value_int) {
for ( j = 0 ; j < new_element->count_int ; j++ ) {
}
else
{
+ _mmcam_dbg_err("invalid count - %d", new_element->count_int);
new_element->value_int = NULL;
}
/* add string values */
- if ( new_element->count_string > 0 ) {
+ if ( new_element->count_string > 0 && new_element->count_string <= 30 &&
+ new_element->count_int >= 0 && new_element->count_int <= 30 ) {
new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
if (new_element->value_string) {
for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
_mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string));
}
} else {
+ _mmcam_dbg_err("invalid count - %d", new_element->count_string);
new_element->value_string = NULL;
}
element_list = NULL;
}
- if (video_caps) {
- gst_caps_unref(video_caps);
- video_caps = NULL;
- }
-
_mmcam_dbg_log("done");
return MM_ERROR_NONE;
element_list = NULL;
}
- if (video_caps) {
- gst_caps_unref(video_caps);
- video_caps = NULL;
- }
-
return err;
}
}
/* Check compatibility between audio codec and file format */
- if (audio_codec >= MM_AUDIO_CODEC_INVALID && audio_codec < MM_AUDIO_CODEC_NUM &&
- file_format >= MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
+ if (audio_codec > MM_AUDIO_CODEC_INVALID && audio_codec < MM_AUDIO_CODEC_NUM &&
+ file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
if (audiocodec_fileformat_compatibility_table[audio_codec][file_format] == 0) {
_mmcam_dbg_err("Audio codec[%d] and file format[%d] compatibility FAILED.",
audio_codec, file_format);
}
/* Check compatibility between audio codec and file format */
- if (video_codec >= MM_VIDEO_CODEC_INVALID && video_codec < MM_VIDEO_CODEC_NUM &&
- file_format >= MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
+ if (video_codec > MM_VIDEO_CODEC_INVALID && video_codec < MM_VIDEO_CODEC_NUM &&
+ file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
if (videocodec_fileformat_compatibility_table[video_codec][file_format] == 0) {
_mmcam_dbg_err("Video codec[%d] and file format[%d] compatibility FAILED.",
video_codec, file_format);
structure = gst_caps_get_structure(caps, 0);
if (structure) {
+ const gchar *format_string = NULL;
int caps_width = 0;
int caps_height = 0;
int caps_fps = 0;
int caps_rotate = 0;
- caps_fourcc = _mmcamcorder_convert_fourcc_string_to_value(gst_structure_get_string(structure, "format"));
+ format_string = gst_structure_get_string(structure, "format");
+ if (format_string) {
+ caps_fourcc = _mmcamcorder_convert_fourcc_string_to_value(format_string);
+ }
gst_structure_get_int(structure, "width", &caps_width);
gst_structure_get_int(structure, "height", &caps_height);
gst_structure_get_int(structure, "fps", &caps_fps);
_mmcam_dbg_warn("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream);
}
- switch (display_surface_type) {
- case MM_DISPLAY_SURFACE_X:
- videosink_element_type = strdup("VideosinkElementX");
- break;
- case MM_DISPLAY_SURFACE_EVAS:
- videosink_element_type = strdup("VideosinkElementEvas");
- break;
- case MM_DISPLAY_SURFACE_GL:
- videosink_element_type = strdup("VideosinkElementGL");
- break;
- case MM_DISPLAY_SURFACE_NULL:
- videosink_element_type = strdup("VideosinkElementNull");
- break;
- case MM_DISPLAY_SURFACE_REMOTE:
- videosink_element_type = strdup("VideosinkElementRemote");
- break;
- default:
- videosink_element_type = strdup("VideosinkElementX");
- break;
- }
-
if (socket_path == NULL) {
_mmcam_dbg_warn("Socket Path is not properly set, -> to NullSink.");
videosink_element_type = strdup("VideosinkElementNull");
+ } else {
+ switch (display_surface_type) {
+ case MM_DISPLAY_SURFACE_X:
+ videosink_element_type = strdup("VideosinkElementX");
+ break;
+ case MM_DISPLAY_SURFACE_EVAS:
+ videosink_element_type = strdup("VideosinkElementEvas");
+ break;
+ case MM_DISPLAY_SURFACE_GL:
+ videosink_element_type = strdup("VideosinkElementGL");
+ break;
+ case MM_DISPLAY_SURFACE_NULL:
+ videosink_element_type = strdup("VideosinkElementNull");
+ break;
+ case MM_DISPLAY_SURFACE_REMOTE:
+ videosink_element_type = strdup("VideosinkElementRemote");
+ break;
+ default:
+ videosink_element_type = strdup("VideosinkElementX");
+ break;
+ }
}
/* check string of videosink element */
/* release */
for (i = 0; i < *argc; i++) {
if (argv[i]) {
- free(argv[i]);
+ g_free(argv[i]);
argv[i] = NULL;
}
}
MMCamAttrsInfo *infoW = NULL;
MMCamAttrsInfo *infoH = NULL;
int i = 0;
- char nameFps[5] = {0,};
+ char nameFps[10] = {0,};
bool valid_check = false;
type_int_array *fps_array;
//_mmcam_dbg_log("prev resolution w:%d, h:%d", width, height);
infoW = (MMCamAttrsInfo*)calloc(1, sizeof(MMCamAttrsInfo));
+ if (infoW == NULL) {
+ _mmcam_dbg_err("failed to alloc infoW");
+ return MM_ERROR_CAMCORDER_LOW_MEMORY;
+ }
+
infoH = (MMCamAttrsInfo*)calloc(1, sizeof(MMCamAttrsInfo));
+ if (infoH == NULL) {
+ _mmcam_dbg_err("failed to alloc infoH");
+
+ free(infoW);
+ infoW = NULL;
+
+ return MM_ERROR_CAMCORDER_LOW_MEMORY;
+ }
mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_WIDTH, infoW);
mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_HEIGHT, infoH);
//_mmcam_dbg_log("width :%d, height : %d\n", infoW->int_array.array[i], infoH->int_array.array[i]);
if(infoW->int_array.array[i] == width && infoH->int_array.array[i] == height) {
valid_check = true;
- sprintf(nameFps, "FPS%d", i);
+ snprintf(nameFps, 10, "FPS%d", i);
_mmcam_dbg_log("nameFps : %s!!!", nameFps);
break;
}
}
- if(infoW)
- free(infoW);
- if(infoH)
- free(infoH);
+ free(infoW);
+ infoW = NULL;
+ free(infoH);
+ infoH = NULL;
if(!valid_check) {
_mmcam_dbg_err("FAILED : Can't find the valid resolution from attribute.");
NULL);
*/
}
+
+/*
if (pulse_op) {
pa_operation_unref(pulse_op);
pulse_op = NULL;
}
+*/
pthread_mutex_unlock(&(info->open_mutex));
/* get ExifData from exif info */
ed = mm_exif_get_exif_from_info(hcamcorder->exif_info);
- if (ed == NULL || ed->ifd == NULL) {
- _mmcam_dbg_err("get exif data error!!(%p, %p)", ed, (ed ? ed->ifd : NULL));
+ if (ed == NULL) {
+ _mmcam_dbg_err("get exif data error!!");
return MM_ERROR_INVALID_HANDLE;
}
#endif
/*6. EXIF_TAG_IMAGE_DESCRIPTION */
mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &str_value, &str_val_len, NULL);
- _mmcam_dbg_log("desctiption [%s]", str_value);
if (str_value && str_val_len > 0) {
char *description = strdup(str_value);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION,
- EXIF_FORMAT_ASCII, strlen(description), (const char *)description);
- free(description);
- str_value = NULL;
- str_val_len = 0;
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_DESCRIPTION);
+
+ _mmcam_dbg_log("desctiption [%s]", str_value);
+
+ if (description) {
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION,
+ EXIF_FORMAT_ASCII, strlen(description), (const char *)description);
+ free(description);
+ str_value = NULL;
+ str_val_len = 0;
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_DESCRIPTION);
+ }
+ } else {
+ _mmcam_dbg_err("strdup failed for [%s]", str_value);
}
} else {
_mmcam_dbg_warn("failed to get description");
while (local_list) {
element = (_MMCamcorderGstElement*)local_list->data;
- if (element && element->gst) {
+ if (pre_element && pre_element->gst && element && element->gst) {
if (_MM_GST_ELEMENT_LINK(GST_ELEMENT(pre_element->gst), GST_ELEMENT(element->gst))) {
_mmcam_dbg_log("Link [%s] to [%s] OK",
GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
}
err = scanf("%d",&idx);
- if( idx > 0 && idx <= count ) {
+ if( idx > 0 && idx <= count && count <= 30) {
bret = camcordertest_set_attr_int("camera-shutter-speed", array[idx-1]);
}
}