Name: libmm-camcorder
Summary: Camera and recorder library
-Version: 0.10.179
+Version: 0.10.180
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
#define MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB "support-media-packet-preview-cb"
/**
+* Support user buffer for zero copy
+*/
+#define MMCAM_SUPPORT_USER_BUFFER "support-user-buffer"
+
+/**
+* Buffer fd from user
+*/
+#define MMCAM_USER_BUFFER_FD "user-buffer-fd"
+
+/**
* Enable to write tags for recorded file
*/
#define MMCAM_RECORDER_TAG_ENABLE "recorder-tag-enable"
MM_CAM_GDBUS_CONNECTION, /* 130 */
MM_CAM_AUDIO_REPLAY_GAIN_ENABLE,
MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL,
+ MM_CAM_SUPPORT_USER_BUFFER,
+ MM_CAM_USER_BUFFER_FD,
MM_CAM_ATTRIBUTE_NUM
} MMCamcorderAttrsID;
int use_zero_copy_format; /**< Whether use zero copy format for camera input */
int use_videoconvert; /**< Whether use videoconvert element for display */
int support_media_packet_preview_cb; /**< Whether support zero copy format for camera input */
+ int support_user_buffer; /**< Whether support user allocated buffer for zero copy */
int shutter_sound_policy; /**< shutter sound policy */
int brightness_default; /**< default value of brightness */
int brightness_step_denominator; /**< denominator of brightness bias step */
{.double_min = 0.0},
{.double_max = 150.0},
_mmcamcorder_commit_audio_replay_gain,
+ },
+ {
+ MM_CAM_SUPPORT_USER_BUFFER,
+ "support-user-buffer",
+ MM_ATTRS_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
+ },
+ {
+ MM_CAM_USER_BUFFER_FD,
+ "user-buffer-fd",
+ MM_ATTRS_TYPE_DATA,
+ MM_ATTRS_FLAG_RW,
+ {NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
}
};
{ "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {.value_int = 0} },
{ "DeviceCount", CONFIGURE_VALUE_INT, {.value_int = MM_VIDEO_DEVICE_NUM} },
{ "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {.value_int = 0} },
+ { "SupportUserBuffer", CONFIGURE_VALUE_INT, {.value_int = 0} },
};
/* [AudioInput] matching table */
char decoder_name[20] = {'\0',};
#endif /* _MMCAMCORDER_RM_SUPPORT */
GstElement *sink_element = NULL;
+ GstCameraControl *control = NULL;
int sink_element_size = 0;
+ int *fds = NULL;
+ int fd_number = 0;
GList *element_list = NULL;
return err;
}
+ if (hcamcorder->support_user_buffer) {
+ err = mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_USER_BUFFER_FD, &fds, &fd_number,
+ NULL);
+ if (err != MM_ERROR_NONE || fd_number < 1) {
+ _mmcam_dbg_err("get user buffer fd failed 0x%x, number %d", err, fd_number);
+ return err;
+ }
+
+ /*
+ for (i = 0 ; i < fd_number ; i++)
+ _mmcam_dbg_log("fds[%d] %d", i, fds[i]);
+ */
+ }
+
/* Get fourcc from picture format */
sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
/* Set video device index */
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "camera-id", input_index->default_value);
+ /* set user buffer fd to videosrc element */
+ if (hcamcorder->support_user_buffer) {
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_set_user_buffer_fd(control, fds, fd_number)) {
+ _mmcam_dbg_err("set user buffer fd failed");
+ goto pipeline_creation_error;
+ }
+ }
+
/* make demux and decoder for H264 stream from videosrc */
if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
int preview_bitrate = 0;
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"UseZeroCopyFormat",
- &(hcamcorder->use_zero_copy_format));
+ &hcamcorder->use_zero_copy_format);
+
+ /* Get SupportUserBuffer value from INI */
+ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ "SupportUserBuffer",
+ &hcamcorder->support_user_buffer);
/* Get SupportMediaPacketPreviewCb value from INI */
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"SupportMediaPacketPreviewCb",
- &(hcamcorder->support_media_packet_preview_cb));
+ &hcamcorder->support_media_packet_preview_cb);
/* Get UseVideoconvert value from INI */
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
mm_camcorder_get_fps_list_by_resolution((MMHandleType)hcamcorder, resolution_width, resolution_height, &fps_info);
- _mmcam_dbg_log("UseZeroCopyFormat %d, UseVideoconvert %d, SupportMediaPacketPreviewCb %d",
- hcamcorder->use_zero_copy_format, hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb);
+ _mmcam_dbg_log("ZeroCopy %d, UserBuffer %d, Videoconvert %d, MPPreviewCb %d",
+ hcamcorder->use_zero_copy_format, hcamcorder->support_user_buffer,
+ hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb);
+
_mmcam_dbg_log("res : %d X %d, Default FPS by resolution : %d",
resolution_width, resolution_height, fps_info.int_array.def);
MMCAM_SUPPORT_ZSL_CAPTURE, hcamcorder->support_zsl_capture,
MMCAM_SUPPORT_ZERO_COPY_FORMAT, hcamcorder->use_zero_copy_format,
MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, hcamcorder->support_media_packet_preview_cb,
+ MMCAM_SUPPORT_USER_BUFFER, hcamcorder->support_user_buffer,
MMCAM_CAMERA_FPS, fps_info.int_array.def,
MMCAM_DISPLAY_FLIP, camera_default_flip,
MMCAM_CAPTURE_SOUND_ENABLE, play_capture_sound,