AC_SUBST(GST_VIDEO_CFLAGS)
AC_SUBST(GST_VIDEO_LIBS)
-#PKG_CHECK_MODULES(GTK, gtk+-2.0)
-#AC_SUBST(GTK_CFLAGS)
-#AC_SUBST(GTK_LIBS)
+PKG_CHECK_MODULES(GST_APP, gstreamer-app-1.0 >= 1.2.0)
+AC_SUBST(GST_APP_CFLAGS)
+AC_SUBST(GST_APP_LIBS)
PKG_CHECK_MODULES(MM_COMMON, mm-common)
AC_SUBST(MM_COMMON_CFLAGS)
AC_SUBST(MM_LOG_CFLAGS)
AC_SUBST(MM_LOG_LIBS)
-PKG_CHECK_MODULES(MMTA, mm-ta)
-AC_SUBST(MMTA_CFLAGS)
-AC_SUBST(MMTA_LIBS)
-
PKG_CHECK_MODULES(MM_SOUND, mm-sound)
AC_SUBST(MM_SOUND_CFLAGS)
AC_SUBST(MM_SOUND_LIBS)
-PKG_CHECK_MODULES(AVSYSTEM, avsysaudio)
-AC_SUBST(AVSYSTEM_CFLAGS)
-AC_SUBST(AVSYSTEM_LIBS)
-
-#PKG_CHECK_MODULES(INIPARSER, iniparser)
-#AC_SUBST(INIPARSER_CFLAGS)
-#AC_SUBST(INIPARSER_LIBS)
-
PKG_CHECK_MODULES(EXIF, libexif)
AC_SUBST(EXIF_CFLAGS)
AC_SUBST(EXIF_LIBS)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-PKG_CHECK_MODULES(MMSESSION, mm-session)
-AC_SUBST(MMSESSION_CFLAGS)
-AC_SUBST(MMSESSION_LIBS)
-
-PKG_CHECK_MODULES(AUDIOSESSIONMGR, audio-session-mgr)
-AC_SUBST(AUDIOSESSIONMGR_CFLAGS)
-AC_SUBST(AUDIOSESSIONMGR_LIBS)
-
PKG_CHECK_MODULES(MMSOUND, mm-sound)
AC_SUBST(MMSOUND_CFLAGS)
AC_SUBST(MMSOUND_LIBS)
AC_SUBST(VCONF_CFLAGS)
AC_SUBST(VCONF_LIBS)
+PKG_CHECK_MODULES(SYSTEMINFO, capi-system-info)
+AC_SUBST(SYSTEMINFO_CFLAGS)
+AC_SUBST(SYSTEMINFO_LIBS)
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h memory.h stdlib.h string.h sys/time.h unistd.h])
Name: mm-camcorder
Description: Multimedia Framework Camcorder Library
-Requires: gstreamer-1.0 gstreamer-base-1.0 gstreamer-video-1.0 mm-common mm-log libexif mm-ta
-Version: @VERSION@
-Libs: -L${libdir} -lmmfcamcorder
+Requires: gstreamer-1.0 gstreamer-base-1.0 mm-common mm-log libexif
+Version: $VERSION
+Libs: -L${libdir} -lmmfcamcorder
Cflags: -I${includedir}/ -I${includedir}/mmf
Name: libmm-camcorder
Summary: Camera and recorder library
-Version: 0.7.16
+Version: 0.9.0
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
Requires(post): /usr/bin/vconftool
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
+BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(mm-common)
BuildRequires: pkgconfig(mm-sound)
-BuildRequires: pkgconfig(avsystem)
BuildRequires: pkgconfig(libexif)
BuildRequires: pkgconfig(mmutil-imgp)
BuildRequires: pkgconfig(mm-log)
-BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
-BuildRequires: pkgconfig(mm-ta)
+BuildRequires: pkgconfig(gstreamer-base-1.0)
BuildRequires: pkgconfig(sndfile)
-BuildRequires: pkgconfig(mm-session)
-BuildRequires: pkgconfig(audio-session-mgr)
BuildRequires: pkgconfig(camsrcjpegenc)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(vconf)
+BuildRequires: gst-plugins-base-devel
+BuildRequires: gstreamer-devel
%description
Camera and recorder library.
Version: %{version}
Requires: %{name} = %{version}-%{release}
-%description devel
+%description devel
Camera and recorder development library.
%prep
-%setup -q
+%setup -q
%build
-export CFLAGS+=" -DGST_EXT_TIME_ANALYSIS"
./autogen.sh
%configure --disable-static
make %{?jobs:-j%jobs}
%{_datadir}/license/%{name}
%files devel
-%manifest libmm-camcorder.manifest
%defattr(-,root,root,-)
%{_includedir}/mmf/mm_camcorder.h
%{_libdir}/pkgconfig/mm-camcorder.pc
libmmfcamcorder_la_CFLAGS = -I$(srcdir)/include \
$(GST_CFLAGS) \
$(GST_PLUGIN_BASE_CFLAGS) \
- $(GST_VIDEO_CFLAGS) \
+ $(GST_VIDEO_CFLAGS) \
+ $(GST_APP_CFLAGS) \
$(MM_LOG_CFLAGS) \
- $(MMTA_CFLAGS) \
$(EXIF_CFLAGS) \
$(MM_COMMON_CFLAGS) \
- $(MMSESSION_CFLAGS) \
$(MMSOUND_CFLAGS) \
- $(AVSYSTEM_CFLAGS) \
$(SNDFILE_CFLAGS) \
$(CAMSRCJPEGENC_CFLAGS) \
$(VCONF_CFLAGS) \
$(MMUTIL_IMGP_CFLAGS) \
- $(AUDIOSESSIONMGR_CFLAGS)
+ $(SYSTEMINFO_CFLAGS)
libmmfcamcorder_la_LIBADD = \
$(GST_LIBS) \
$(GST_PLUGIN_BASE_LIBS) \
- $(GST_VIDEO_LIBS) \
+ $(GST_VIDEO_LIBS) \
+ $(GST_APP_LIBS) \
$(MM_COMMON_LIBS) \
$(MM_LOG_LIBS) \
- $(MMTA_LIBS) \
$(EXIF_LIBS) \
- $(MMSESSION_LIBS) \
$(MMSOUND_LIBS) \
- $(AVSYSTEM_LIBS) \
$(SNDFILE_LIBS) \
$(CAMSRCJPEGENC_LIBS) \
$(VCONF_LIBS) \
- $(MMUTIL_IMGP_LIBS) \
- $(AUDIOSESSIONMGR_LIBS)
+ $(MMUTIL_IMGP_LIBS)
-libmmfcamcorder_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x010 -DMMF_DEBUG_PREFIX=\"MMF-CAMCORDER\" -D_INTERNAL_SESSION_MANAGER_
-libmmfcamcorder_la_LIBADD += $(MMLOGSVR_LIBS)
+libmmfcamcorder_la_CFLAGS += -DMMF_LOG_OWNER=0x010 -D_FILE_OFFSET_BITS=64
+libmmfcamcorder_la_CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections
+libmmfcamcorder_la_LIBADD += $(SYSTEMINFO_LIBS)
install-exec-hook:
mkdir -p $(DESTDIR)$(prefix)/share/sounds/mm-camcorder && \
- cp $(srcdir)/../sounds/*.wav $(DESTDIR)$(prefix)/share/sounds/mm-camcorder/
+ cp $(srcdir)/../sounds/* $(DESTDIR)$(prefix)/share/sounds/mm-camcorder/
/**
* Frames per second. This is an integer field
- *
+ *
*/
#define MMCAM_CAMERA_FPS "camera-fps"
/**
- * Width of input video stream.
+ * Width of preview stream.
*/
#define MMCAM_CAMERA_WIDTH "camera-width"
/**
- * Height of input video stream.
- * @see
+ * Height of preview stream.
*/
#define MMCAM_CAMERA_HEIGHT "camera-height"
/**
+ * Width of video stream.
+ */
+#define MMCAM_VIDEO_WIDTH "video-width"
+
+/**
+ * Height of video stream.
+ */
+#define MMCAM_VIDEO_HEIGHT "video-height"
+
+/**
* Digital zoom level.
*/
#define MMCAM_CAMERA_DIGITAL_ZOOM "camera-digital-zoom"
#define MMCAM_CAMERA_FLIP "camera-flip"
/**
- * X coordinate of Face zoom.
+ * Support Zero Shutter Lag capture
*/
-#define MMCAM_CAMERA_FACE_ZOOM_X "camera-face-zoom-x"
+#define MMCAM_SUPPORT_ZSL_CAPTURE "support-zsl-capture"
/**
- * Y coordinate of Face zoom.
- */
-#define MMCAM_CAMERA_FACE_ZOOM_Y "camera-face-zoom-y"
+* Support zero copy format
+*/
+#define MMCAM_SUPPORT_ZERO_COPY_FORMAT "support-zero-copy-format"
/**
- * Zoom level of Face zoom.
- */
-#define MMCAM_CAMERA_FACE_ZOOM_LEVEL "camera-face-zoom-level"
-
-/**
- * Mode of Face zoom.
- * @see MMCamcorderFaceZoomMode
- */
-#define MMCAM_CAMERA_FACE_ZOOM_MODE "camera-face-zoom-mode"
+* Support media packet callback
+*/
+#define MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB "support-media-packet-preview-cb"
/*=======================================================================================
/**
* An enumeration for white balance. White Balance is the control that adjusts
- * the camcorder's color sensitivity to match the prevailing color of white
- * outdoor light, yellower indoor light, or (sometimes) greenish fluorescent
- * light. White balance may be set either automatically or manually. White balance
- * may be set "incorrectly" on purpose to achieve special effects.
+ * the camcorder's color sensitivity to match the prevailing color of white
+ * outdoor light, yellower indoor light, or (sometimes) greenish fluorescent
+ * light. White balance may be set either automatically or manually. White balance
+ * may be set "incorrectly" on purpose to achieve special effects.
*/
enum MMCamcorderWhiteBalanceType {
MM_CAMCORDER_WHITE_BALANCE_NONE = 0, /**< None */
MM_CAMCORDER_WHITE_BALANCE_HORIZON, /**< Horizon */
MM_CAMCORDER_WHITE_BALANCE_FLASH, /**< Flash */
MM_CAMCORDER_WHITE_BALANCE_CUSTOM, /**< Custom */
-
};
/**
* An enumeration for scene mode. Scene mode gives the environment condition
- * for operating camcorder. The mode of operation can be in daylight, night and
+ * for operating camcorder. The mode of operation can be in daylight, night and
* backlight. It can be an automatic setting also.
*/
enum MMCamcorderSceneModeType {
MM_CAMCORDER_SCENE_MODE_SHOW_WINDOW, /**< Show window */
MM_CAMCORDER_SCENE_MODE_CANDLE_LIGHT, /**< Candle light */
MM_CAMCORDER_SCENE_MODE_BACKLIGHT, /**< Backlight */
+ MM_CAMCORDER_SCENE_MODE_AQUA, /**< Aqua */
};
*/
enum MMCamcorderFocusMode {
MM_CAMCORDER_FOCUS_MODE_NONE = 0, /**< Focus mode is None */
- MM_CAMCORDER_FOCUS_MODE_PAN, /**< Pan focus mode*/
- MM_CAMCORDER_FOCUS_MODE_AUTO, /**< Autofocus mode*/
+ MM_CAMCORDER_FOCUS_MODE_PAN, /**< Pan focus mode*/
+ MM_CAMCORDER_FOCUS_MODE_AUTO, /**< Autofocus mode*/
MM_CAMCORDER_FOCUS_MODE_MANUAL, /**< Manual focus mode*/
MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO, /**< Touch Autofocus mode*/
MM_CAMCORDER_FOCUS_MODE_CONTINUOUS, /**< Continuous Autofocus mode*/
/**
- * An enumeration for Face zoom mode.
- */
-enum MMCamcorderFaceZoomMode {
- MM_CAMCORDER_FACE_ZOOM_MODE_OFF = 0, /**< turn face zoom off */
- MM_CAMCORDER_FACE_ZOOM_MODE_ON, /**< turn face zoom on */
-};
-
-/**
* An enumeration for recommended preview resolution.
*/
enum MMCamcorderPreviewType {
MM_CAMCORDER_PREVIEW_TYPE_NORMAL = 0, /**< normal ratio like 4:3 */
MM_CAMCORDER_PREVIEW_TYPE_WIDE, /**< wide ratio like 16:9 */
+ MM_CAMCORDER_PREVIEW_TYPE_SQUARE, /**< square ratio like 1:1 */
};
/**
* Structure for video stream data.
*/
+#define BUFFER_MAX_PLANE_NUM 4
+
typedef struct {
union {
struct {
int width; /**< width of video buffer */
int height; /**< height of video buffer */
unsigned int timestamp; /**< timestamp of stream buffer (msec)*/
+ void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
+ void *internal_buffer; /**< Internal buffer pointer */
} MMCamcorderVideoStreamDataType;
/*=======================================================================================
| INCLUDE FILES |
========================================================================================*/
+#include <gst/gst.h>
#include <mm_types.h>
#include <stdarg.h>
MM_CAM_CAMERA_WDR,
MM_CAM_CAMERA_ANTI_HANDSHAKE,
MM_CAM_CAMERA_FPS_AUTO,
- MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING,
MM_CAM_CAMERA_DELAY_ATTR_SETTING,
- MM_CAM_AUDIO_ENCODER_BITRATE, /* 40 */
- MM_CAM_VIDEO_ENCODER_BITRATE,
+ MM_CAM_AUDIO_ENCODER_BITRATE,
+ MM_CAM_VIDEO_ENCODER_BITRATE, /* 40 */
MM_CAM_IMAGE_ENCODER_QUALITY,
MM_CAM_CAPTURE_FORMAT,
MM_CAM_CAPTURE_WIDTH,
MM_CAM_CAPTURE_INTERVAL,
MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
MM_CAM_DISPLAY_HANDLE,
- MM_CAM_DISPLAY_DEVICE, /* 50 */
- MM_CAM_DISPLAY_SURFACE,
+ MM_CAM_DISPLAY_DEVICE,
+ MM_CAM_DISPLAY_SURFACE, /* 50 */
MM_CAM_DISPLAY_RECT_X,
MM_CAM_DISPLAY_RECT_Y,
MM_CAM_DISPLAY_RECT_WIDTH,
MM_CAM_DISPLAY_SOURCE_Y,
MM_CAM_DISPLAY_SOURCE_WIDTH,
MM_CAM_DISPLAY_SOURCE_HEIGHT,
- MM_CAM_DISPLAY_ROTATION, /* 60 */
- MM_CAM_DISPLAY_VISIBLE,
+ MM_CAM_DISPLAY_ROTATION,
+ MM_CAM_DISPLAY_VISIBLE, /* 60 */
MM_CAM_DISPLAY_SCALE,
MM_CAM_DISPLAY_GEOMETRY_METHOD,
MM_CAM_TARGET_FILENAME,
MM_CAM_TAG_ENABLE,
MM_CAM_TAG_IMAGE_DESCRIPTION,
MM_CAM_TAG_ORIENTATION,
- MM_CAM_TAG_SOFTWARE, /* 70 */
- MM_CAM_TAG_LATITUDE,
+ MM_CAM_TAG_SOFTWARE,
+ MM_CAM_TAG_LATITUDE, /* 70 */
MM_CAM_TAG_LONGITUDE,
MM_CAM_TAG_ALTITUDE,
MM_CAM_STROBE_CONTROL,
MM_CAM_DETECT_MODE,
MM_CAM_DETECT_NUMBER,
MM_CAM_DETECT_FOCUS_SELECT,
- MM_CAM_DETECT_SELECT_NUMBER, /* 80 */
- MM_CAM_DETECT_STATUS,
+ MM_CAM_DETECT_SELECT_NUMBER,
+ MM_CAM_DETECT_STATUS, /* 80 */
MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
MM_CAM_CAMERA_AF_TOUCH_X,
MM_CAM_CAMERA_AF_TOUCH_Y,
MM_CAM_CAMERA_FOCAL_LENGTH,
MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
- MM_CAM_CAPTURE_THUMBNAIL, /* 90 */
MM_CAM_TAG_GPS_ENABLE,
- MM_CAM_TAG_GPS_TIME_STAMP,
+ MM_CAM_TAG_GPS_TIME_STAMP, /* 90 */
MM_CAM_TAG_GPS_DATE_STAMP,
MM_CAM_TAG_GPS_PROCESSING_METHOD,
MM_CAM_CAMERA_ROTATION,
- MM_CAM_ENABLE_CONVERTED_STREAM_CALLBACK,
MM_CAM_CAPTURED_SCREENNAIL,
MM_CAM_CAPTURE_SOUND_ENABLE,
MM_CAM_RECOMMEND_DISPLAY_ROTATION,
- MM_CAM_CAMERA_FLIP, /* 100 */
+ MM_CAM_CAMERA_FLIP,
MM_CAM_CAMERA_HDR_CAPTURE,
MM_CAM_DISPLAY_MODE,
- MM_CAM_CAMERA_FACE_ZOOM_X,
- MM_CAM_CAMERA_FACE_ZOOM_Y,
- MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
- MM_CAM_CAMERA_FACE_ZOOM_MODE,
- MM_CAM_AUDIO_DISABLE,
+ MM_CAM_AUDIO_DISABLE, /* 100 */
MM_CAM_RECOMMEND_CAMERA_WIDTH,
MM_CAM_RECOMMEND_CAMERA_HEIGHT,
- MM_CAM_CAPTURED_EXIF_RAW_DATA, /* 110 */
+ MM_CAM_CAPTURED_EXIF_RAW_DATA,
MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
MM_CAM_DISPLAY_EVAS_DO_SCALING,
MM_CAM_CAMERA_FACING_DIRECTION,
MM_CAM_DISPLAY_FLIP,
MM_CAM_CAMERA_VIDEO_STABILIZATION,
MM_CAM_TAG_VIDEO_ORIENTATION,
- MM_CAM_NUM
+ MM_CAM_VIDEO_WIDTH, /* 110 */
+ MM_CAM_VIDEO_HEIGHT,
+ MM_CAM_SUPPORT_ZSL_CAPTURE,
+ MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
+ MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
+ MM_CAM_ATTRIBUTE_NUM
}MMCamcorderAttrsID;
/*=======================================================================================
========================================================================================*/
typedef struct {
MMCamcorderAttrsID attrid;
- char *name;
+ const char *name;
int value_type;
int flags;
union {
double value_double;
} default_value; /* default value */
MMCamAttrsValidType validity_type;
- int validity_value1; /* can be int min, int *array, double *array, or cast to double min. */
- int validity_value2; /* can be int max, int count, int count, or cast to double max. */
+ union {
+ int *int_array;
+ int int_min;
+ double *double_array;
+ double double_min;
+ } validity_value_1;
+ union {
+ int int_max;
+ double double_max;
+ int count;
+ } validity_value_2;
mmf_cam_commit_func_t attr_commit;
} mm_cam_attr_construct_info;
/**
* This function release structure of attributes.
*
+ * @param[in] handle Handle of camcorder.
* @param[in] attrs Handle of camcorder attribute.
* @return void
* @remarks
* @see _mmcamcorder_alloc_attribute()
*
*/
-void _mmcamcorder_dealloc_attribute(MMHandleType attrs);
+void _mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs);
/**
* This is a meta function to get attributes of camcorder with given attribute names.
bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_focus_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_af_scan_range(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_video_stabilization(MMHandleType handle, int attr_idx, const mmf_value_t *value);
-bool _mmcamcorder_commit_camera_hold_af_after_capturing(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
-bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const mmf_value_t *value);
========================================================================================*/
typedef struct _type_int type_int;
struct _type_int {
+ const char *name;
+ int value;
+};
+
+typedef struct _type_int2 type_int2;
+struct _type_int2 {
char *name;
int value;
};
typedef struct _type_string type_string;
struct _type_string {
+ const char *name;
+ const char *value;
+};
+
+typedef struct _type_string2 type_string2;
+struct _type_string2 {
char *name;
char *value;
};
typedef struct _type_element type_element;
struct _type_element {
- char *name;
- char *element_name;
+ const char *name;
+ const char *element_name;
type_int **value_int;
int count_int;
type_string **value_string;
int count_string;
};
-typedef struct _conf_info conf_info;
-struct _conf_info {
+typedef struct _type_element2 type_element2;
+struct _type_element2 {
+ char *name;
+ char *element_name;
+ type_int2 **value_int;
+ int count_int;
+ type_string2 **value_string;
+ int count_string;
+};
+
+typedef struct _conf_detail conf_detail;
+struct _conf_detail {
int count;
void **detail_info;
};
typedef struct _conf_info_table conf_info_table;
struct _conf_info_table {
- char *name;
+ const char *name;
int value_type;
union {
+ type_element *value_element;
int value_int;
char *value_string;
- type_element *value_element;
};
};
typedef struct _camera_conf camera_conf;
struct _camera_conf {
int type;
- conf_info **info;
+ conf_detail **info;
};
/*=======================================================================================
/**
* This function creates configure info structure from ini file.
*
+ * @param[in] handle Handle of camcorder.
* @param[in] type configure type(MAIN or CTRL).
* @param[in] ConfFile ini file path.
* @param[out] configure_info configure structure to be got.
* @see _mmcamcorder_conf_release_info()
*
*/
-int _mmcamcorder_conf_get_info(int type, char *ConfFile, camera_conf **configure_info);
+int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char *ConfFile, camera_conf **configure_info);
/**
* This function releases configure info.
*
+ * @param[in] handle Handle of camcorder.
* @param[in] configure_info configure structure to be released.
* @return void
* @remarks
* @see _mmcamcorder_conf_get_info()
*
*/
-void _mmcamcorder_conf_release_info(camera_conf **configure_info);
+void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf **configure_info);
/**
* This function gets integer type value from configure info.
*
+ * @param[in] handle Handle of camcorder.
* @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
* @param[in] category configure category.
* @param[in] name detail name in category.
* @see
*
*/
-int _mmcamcorder_conf_get_value_int(camera_conf *configure_info, int category, char *name, int *value);
+int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf *configure_info, int category, const char *name, int *value);
/**
* This function gets integer-range type value from configure info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, char *name, type_int_range **value);
+int _mmcamcorder_conf_get_value_int_range(camera_conf *configure_info, int category, const char *name, type_int_range **value);
/**
* This function gets integer-array type value from configure info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, char *name, type_int_array **value);
+int _mmcamcorder_conf_get_value_int_array(camera_conf *configure_info, int category, const char *name, type_int_array **value);
/**
* This function gets integer-pair-array type value from configure info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, char *name, type_int_pair_array **value);
+int _mmcamcorder_conf_get_value_int_pair_array(camera_conf *configure_info, int category, const char *name, type_int_pair_array **value);
/**
* This function gets string type value from configure info.
*
+ * @param[in] handle Handle of camcorder.
* @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
* @param[in] category configure category.
* @param[in] name detail name in category.
* @see
*
*/
-int _mmcamcorder_conf_get_value_string(camera_conf *configure_info, int category, char *name, char **value);
+int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf *configure_info, int category, const char *name, const char **value);
/**
* This function gets string-array type value from configure info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, char *name, type_string_array **value);
+int _mmcamcorder_conf_get_value_string_array(camera_conf *configure_info, int category, const char *name, type_string_array **value);
/**
* This function gets element info from configure info.
*
+ * @param[in] handle Handle of camcorder.
* @param[in] configure_info configure structure created by _mmcamcorder_conf_get_info.
* @param[in] category configure category.
* @param[in] name detail name in category.
* @see
*
*/
-int _mmcamcorder_conf_get_element(camera_conf *configure_info, int category, char *name, type_element **element);
+int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf *configure_info, int category, const char *name, type_element **element);
/**
* This function gets element name from element info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_element_name(type_element *element, char **value);
+int _mmcamcorder_conf_get_value_element_name(type_element *element, const char **value);
/**
* This function gets integer value of element's named property from element info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_element_int(type_element *element, char *name, int *value);
+int _mmcamcorder_conf_get_value_element_int(type_element *element, const char *name, int *value);
/**
* This function gets string value of element's named property from element info.
* @see
*
*/
-int _mmcamcorder_conf_get_value_element_string(type_element *element, char *name, char **value);
+int _mmcamcorder_conf_get_value_element_string(type_element *element, const char *name, const char **value);
/**
* This function sets all property of element info.
* @see
*
*/
-void _mmcamcorder_conf_print_info(camera_conf **configure_info);
+void _mmcamcorder_conf_print_info(MMHandleType handle, camera_conf **configure_info);
type_element *_mmcamcorder_get_type_element(MMHandleType handle, int type);
int _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int **format);
/* Internal function */
-void _mmcamcorder_conf_init(int type, camera_conf **configure_info);
-int _mmcamcorder_conf_parse_info(int type, FILE *fd, camera_conf **configure_info);
-int _mmcamcorder_conf_get_value_type(int type, int category, char *name, int *value_type);
-int _mmcamcorder_conf_add_info(int type, conf_info **info, char **buffer_details, int category, int count_details);
-int _mmcamcorder_conf_get_default_value_int(int type, int category, char *name, int *value);
-int _mmcamcorder_conf_get_default_value_string(int type, int category, char *name, char **value);
-int _mmcamcorder_conf_get_default_element(int type, int category, char *name, type_element **element);
-int _mmcamcorder_conf_get_category_size(int type, int category, int *size);
+void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf **configure_info);
+int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE *fd, camera_conf **configure_info);
+int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char *name, int *value_type);
+int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail **info, char **buffer_details, int category, int count_details);
+int _mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char *name, int *value);
+int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char *name, const char **value);
+int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char *name, type_element **element);
+int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int *size);
#ifdef __cplusplus
}
#include <libexif/exif-tag.h>
#include <libexif/exif-format.h>
#include <libexif/exif-data.h>
-#include <libexif/samsung/mnote-samsung-tag.h>
#ifdef __cplusplus
extern "C" {
int mm_exif_set_exif_to_info(mm_exif_info_t *info, ExifData *exif);
/**
- * add one tag information into exif
+ * add one tag information into exif
* @param[in] info exif info.
* @param[in] Exif tag .
* @param[in] tag content category.
*/
int mm_exif_set_add_entry(ExifData *exif, ExifIfd ifd, ExifTag tag,
ExifFormat format, unsigned long components,
- unsigned char *data);
+ const char *data);
/**
* Write thumbnail data into exif info.
int width, int height, int len);
/**
- * create ExifMnoteDataSamsung and set up related function pointers
- * @param[in/out] info exif info.
- * @return return int.
- */
-int mm_exif_mnote_create(ExifData *exif);
-
-/**
- * add one Samsung maker note tag information into exif
- * @param[in/out] info exif info.
- * @param[in] Samsung maker note tag .
- * @param[in] tag index.
- * @param[in] sub tag index 1.
- * @param[in] sub tag index 2.
- * @return return int.
- */
-int mm_exif_mnote_set_add_entry(ExifData *exif, MnoteSamsungTag tag,
- int index, int subindex1, int subindex2);
-
-/**
* Write exif info into a jpeg image and then save as a jpeg file.
* @param[in/out] filename jpeg filename.
* @param[in] info exif info.
mm_exif_info_t *info, void *jpeg,
unsigned int jpeg_len);
+/**
+ * Load exif info from a jpeg memory buffer.
+ * @param[out] info exif info.
+ * @param[in] jpeg jpeg image data.
+ * @param[in] length length of jpeg image.
+ * @return return int.
+ */
+int mm_exif_load_exif_info(mm_exif_info_t **info, void *jpeg_data, int jpeg_length);
+
#ifdef __cplusplus
}
#endif
/*=======================================================================================
| GLOBAL FUNCTION PROTOTYPES |
========================================================================================*/
-/* create bin */
+/* create pipeline */
/**
* This function creates bin of video source.
* Basically, main pipeline of camcorder is composed of several bin(a bundle
* @remarks
* @see __mmcamcorder_create_preview_pipeline()
*/
-int _mmcamcorder_create_videosrc_bin(MMHandleType handle);
+int _mmcamcorder_create_preview_elements(MMHandleType handle);
/**
* This function creates bin of audio source.
int _mmcamcorder_create_audiosrc_bin(MMHandleType handle);
/**
- * This function creates bin of video sink.
- * Basically, main pipeline of camcorder is composed of several bin(a bundle
- * of elements). Each bin operates its own function. This bin has a roll
- * transferring video data to frame buffer.
- *
- * @param[in] handle Handle of camcorder context.
- * @return This function returns MM_ERROR_NONE on success, or the other values on error.
- * @remarks
- * @see __mmcamcorder_create_preview_pipeline()
- */
-int _mmcamcorder_create_videosink_bin(MMHandleType handle);
-
-/**
* This function creates outputsink bin.
*
* @param[in] handle Handle of camcorder context.
int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebinProfile profile);
/**
- * This function creates bin of still shot sink.
- * Basically, main pipeline of camcorder is composed of several bin(a bundle
- * of elements). Each bin operates its own function. This bin has a roll
- * writting image file with video stream.
- *
- * @param[in] handle Handle of camcorder context.
- * @return This function returns MM_ERROR_NONE on success, or the other values on error.
- * @remarks
- * @see __mmcamcorder_create_preview_pipeline()
- */
-int _mmcamcorder_create_stillshotsink_bin(MMHandleType handle);
-
-/**
* This function creates main pipeline of camcorder.
* Basically, main pipeline of camcorder is composed of several bin(a bundle
* of elements). And if the appilcation wants to make pipeline working, the
/* plug-in related */
void _mmcamcorder_negosig_handler(GstElement *videosrc, MMHandleType handle);
+void _mmcamcorder_ready_to_encode_callback(GstElement *element, guint size, gpointer handle);
/* etc */
int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element *VideosinkElement);
int _mmcamcorder_vframe_stablize(MMHandleType handle);
gboolean _mmcamcorder_get_device_info(MMHandleType handle);
int _mmcamcorder_get_eos_message(MMHandleType handle);
-void _mmcamcorder_remove_element_handle(MMHandleType handle, int first_elem, int last_elem);
+void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int first_elem, int last_elem);
int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle);
int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle);
bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate);
bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip);
bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate);
+bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, int width, int height, int fps, int rotate);
bool _mmcamcorder_set_videosrc_flip(MMHandleType handle, int viderosrc_flip);
bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake);
bool _mmcamcorder_set_videosrc_stabilization(MMHandleType handle, int stabilization);
+bool _mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height);
#ifdef __cplusplus
}
#include <mm_attrs.h>
#include <mm_attrs_private.h>
#include <mm_message.h>
-#include <mm_ta.h>
#include <sndfile.h>
#include <vconf.h>
#include <gst/video/video-format.h>
/*=======================================================================================
| MACRO DEFINITIONS |
========================================================================================*/
-#define _mmcam_dbg_verb(fmt, args...) mmf_debug(MMF_DEBUG_VERBOSE,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_log(fmt, args...) mmf_debug(MMF_DEBUG_LOG,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_warn(fmt, args...) mmf_debug(MMF_DEBUG_WARNING,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_err(fmt, args...) mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
-#define _mmcam_dbg_crit(fmt, args...) mmf_debug(MMF_DEBUG_CRITICAL,"[%05d][%s]: " fmt "\n", __LINE__, __func__, ##args);
+#define _mmcam_dbg_verb(fmt, args...) debug_verbose (" "fmt"\n", ##args);
+#define _mmcam_dbg_log(fmt, args...) debug_log (" "fmt"\n", ##args);
+#define _mmcam_dbg_warn(fmt, args...) debug_warning (" "fmt"\n", ##args);
+#define _mmcam_dbg_err(fmt, args...) debug_error (" "fmt"\n", ##args);
+#define _mmcam_dbg_crit(fmt, args...) debug_critical (" "fmt"\n", ##args);
/**
* Macro for checking validity and debugging
#endif
/* gstreamer element creation macro */
-#define _MMCAMCORDER_PIPELINE_MAKE(sub_context, eid, name /*char* */, err) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_PIPELINE_MAKE(sub_context, element, eid, name /*char* */, err) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element(Pipeline) is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].id = eid; \
- sub_context->element[eid].gst = gst_pipeline_new(name); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].id = eid; \
+ element[eid].gst = gst_pipeline_new(name); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Pipeline creation fail. element_id=[%d], name=[%s]", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else { \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
}
-#define _MMCAMCORDER_BIN_MAKE(sub_context, eid, name /*char* */, err) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_BIN_MAKE(sub_context, element, eid, name /*char* */, err) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element(Bin) is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].id = eid; \
- sub_context->element[eid].gst = gst_bin_new(name); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].id = eid; \
+ element[eid].gst = gst_bin_new(name); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Bin creation fail. element_id=[%d], name=[%s]\n", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else { \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
}
-#define _MMCAMCORDER_ELEMENT_MAKE(sub_context, eid, name /*char* */, nickname /*char* */, elist, err) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_ELEMENT_MAKE(sub_context, element, eid, name /*char* */, nickname /*char* */, elist, err) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].gst = gst_element_factory_make(name, nickname); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s]", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else { \
_mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
- sub_context->element[eid].id = eid; \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ element[eid].id = eid; \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
err = MM_ERROR_NONE; \
} \
- elist = g_list_append(elist, &(sub_context->element[eid]));
+ elist = g_list_append(elist, &(element[eid]));
-#define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, eid, name /*char* */, nickname /*char* */, elist) \
- if (sub_context->element[eid].gst != NULL) { \
+#define _MMCAMCORDER_ELEMENT_MAKE_IGNORE_ERROR(sub_context, element, eid, name /*char* */, nickname /*char* */, elist) \
+ if (element[eid].gst != NULL) { \
_mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(element[eid].gst); \
} \
- sub_context->element[eid].gst = gst_element_factory_make(name, nickname); \
- if (sub_context->element[eid].gst == NULL) { \
+ element[eid].gst = gst_element_factory_make(name, nickname); \
+ if (element[eid].gst == NULL) { \
_mmcam_dbg_err("Element creation fail. element_id=[%d], name=[%s], but keep going...", eid, name); \
} else { \
_mmcam_dbg_log("Element creation done. element_id=[%d], name=[%s]", eid, name); \
- sub_context->element[eid].id = eid; \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
- elist = g_list_append(elist, &(sub_context->element[eid])); \
+ element[eid].id = eid; \
+ g_object_weak_ref(G_OBJECT(element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ elist = g_list_append(elist, &(element[eid])); \
}
#define _MMCAMCORDER_ENCODEBIN_ELMGET(sub_context, eid, name /*char* */, err) \
- if (sub_context->element[eid].gst != NULL) { \
+ if (sub_context->encode_element[eid].gst != NULL) { \
_mmcam_dbg_err("The element is existed. element_id=[%d], name=[%s]", eid, name); \
- gst_object_unref(sub_context->element[eid].gst); \
+ gst_object_unref(sub_context->encode_element[eid].gst); \
} \
- sub_context->element[eid].id = eid; \
- g_object_get(G_OBJECT(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sc->element[eid].gst), NULL); \
- if (sub_context->element[eid].gst == NULL) { \
- _mmcam_dbg_err("Element get fail. element_id=[%d], name=[%s]", eid, name); \
+ sub_context->encode_element[eid].id = eid; \
+ g_object_get(G_OBJECT(sub_context->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst), name, &(sub_context->encode_element[eid].gst), NULL); \
+ if (sub_context->encode_element[eid].gst == NULL) { \
+ _mmcam_dbg_err("Encode Element get fail. element_id=[%d], name=[%s]", eid, name); \
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION; \
goto pipeline_creation_error; \
} else{ \
- gst_object_unref(sub_context->element[eid].gst); \
- g_object_weak_ref(G_OBJECT(sub_context->element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
+ gst_object_unref(sub_context->encode_element[eid].gst); \
+ g_object_weak_ref(G_OBJECT(sub_context->encode_element[eid].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sub_context); \
}
/* GStreamer element remove macro */
-#define _MMCAMCORDER_ELEMENT_REMOVE(sub_context, eid) \
- if (sub_context->element[eid].gst != NULL) { \
- gst_object_unref(sub_context->element[eid].gst); \
+#define _MMCAMCORDER_ELEMENT_REMOVE(element, eid) \
+ if (element[eid].gst != NULL) { \
+ gst_object_unref(element[eid].gst); \
}
#define _MM_GST_ELEMENT_LINK_MANY gst_element_link_many
#define _MM_GST_ELEMENT_LINK gst_element_link
#define _MM_GST_PAD_LINK gst_pad_link
-#define _MM_GST_PAD_LINK_UNREF( srcpad, sinkpad, err, if_fail_goto ) \
-{ \
- GstPadLinkReturn ret = _MM_GST_PAD_LINK( srcpad, sinkpad ); \
- gst_object_unref( srcpad ); srcpad = NULL; \
- gst_object_unref( sinkpad ); sinkpad = NULL; \
- if (ret != GST_PAD_LINK_OK) { \
- err = MM_ERROR_CAMCORDER_GST_LINK; \
- goto if_fail_goto; \
- } \
+#define _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, if_fail_goto)\
+{\
+ GstPadLinkReturn ret = _MM_GST_PAD_LINK(srcpad, sinkpad);\
+ if (ret != GST_PAD_LINK_OK) {\
+ GstObject *src_parent = gst_pad_get_parent(srcpad);\
+ GstObject *sink_parent = gst_pad_get_parent(sinkpad);\
+ char *src_name = NULL;\
+ char *sink_name = NULL;\
+ g_object_get((GObject *)src_parent, "name", &src_name, NULL);\
+ g_object_get((GObject *)sink_parent, "name", &sink_name, NULL);\
+ _mmcam_dbg_err("src[%s] - sink[%s] link failed", src_name, sink_name);\
+ gst_object_unref(src_parent); src_parent = NULL;\
+ gst_object_unref(sink_parent); sink_parent = NULL;\
+ if (src_name) {\
+ free(src_name); src_name = NULL;\
+ }\
+ if (sink_name) {\
+ free(sink_name); sink_name = NULL;\
+ }\
+ gst_object_unref(srcpad); srcpad = NULL;\
+ gst_object_unref(sinkpad); sinkpad = NULL;\
+ err = MM_ERROR_CAMCORDER_GST_LINK;\
+ goto if_fail_goto;\
+ }\
+ gst_object_unref(srcpad); srcpad = NULL;\
+ gst_object_unref(sinkpad); sinkpad = NULL;\
}
#define _MM_GST_PAD_UNLINK_UNREF( srcpad, sinkpad) \
/**
* Functions related with LOCK and WAIT
*/
-#define _MMCAMCORDER_CAST_MTSAFE(handle) (((mmf_camcorder_t*)handle)->mtsafe)
+#define _MMCAMCORDER_CAST_MTSAFE(handle) (((mmf_camcorder_t*)handle)->mtsafe)
-#define _MMCAMCORDER_GET_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
-#define _MMCAMCORDER_LOCK(handle) g_mutex_lock(_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK(handle) g_mutex_trylock(_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK(handle) g_mutex_unlock(_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_GET_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).lock)
+#define _MMCAMCORDER_LOCK(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
-#define _MMCAMCORDER_WAIT(handle) g_cond_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle))
-#define _MMCAMCORDER_TIMED_WAIT(handle, timeval) g_cond_timed_wait (_MMCAMCORDER_GET_COND(handle), _MMCAMCORDER_GET_LOCK(handle),timeval)
+#define _MMCAMCORDER_GET_COND(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cond)
+#define _MMCAMCORDER_WAIT(handle) pthread_cond_wait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle))
+#define _MMCAMCORDER_TIMED_WAIT(handle, timeval) pthread_cond_timedwait(&_MMCAMCORDER_GET_COND(handle), &_MMCAMCORDER_GET_LOCK(handle), timeval)
-#define _MMCAMCORDER_SIGNAL(handle) g_cond_signal (_MMCAMCORDER_GET_COND(handle));
-#define _MMCAMCORDER_BROADCAST(handle) g_cond_broadcast (_MMCAMCORDER_GET_COND(handle));
+#define _MMCAMCORDER_SIGNAL(handle) pthread_cond_signal(&_MMCAMCORDER_GET_COND(handle))
+#define _MMCAMCORDER_BROADCAST(handle) pthread_cond_broadcast(&_MMCAMCORDER_GET_COND(handle))
/* for command */
-#define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
-#define _MMCAMCORDER_LOCK_CMD(handle) g_mutex_lock(_MMCAMCORDER_GET_CMD_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_CMD(handle) g_mutex_trylock(_MMCAMCORDER_GET_CMD_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_CMD(handle) g_mutex_unlock(_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_GET_CMD_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).cmd_lock)
+#define _MMCAMCORDER_LOCK_CMD(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_CMD(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_CMD_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_CMD(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_CMD_LOCK(handle))
+
+/* for ASM */
+#define _MMCAMCORDER_GET_ASM_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock)
+#define _MMCAMCORDER_LOCK_ASM(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_ASM_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_ASM(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_ASM_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_ASM(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_ASM_LOCK(handle))
/* for state change */
-#define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
-#define _MMCAMCORDER_LOCK_STATE(handle) g_mutex_lock(_MMCAMCORDER_GET_STATE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_STATE(handle) g_mutex_trylock(_MMCAMCORDER_GET_STATE_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_STATE(handle) g_mutex_unlock(_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock)
+#define _MMCAMCORDER_LOCK_STATE(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_STATE(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_STATE(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_STATE_LOCK(handle))
/* for gstreamer state change */
-#define _MMCAMCORDER_GET_GST_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
-#define _MMCAMCORDER_LOCK_GST_STATE(handle) g_mutex_lock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_GST_STATE(handle) g_mutex_trylock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_GST_STATE(handle) g_mutex_unlock(_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_GET_GST_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_state_lock)
+#define _MMCAMCORDER_LOCK_GST_STATE(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_GST_STATE(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_GST_STATE(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_GST_STATE_LOCK(handle))
+
+#define _MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).gst_encode_state_lock)
+#define _MMCAMCORDER_LOCK_GST_ENCODE_STATE(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_GST_ENCODE_STATE(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_GST_ENCODE_STATE(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle))
/* for setting/calling callback */
#define _MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).message_cb_lock)
-#define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_MESSAGE_CALLBACK(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_MESSAGE_CALLBACK_LOCK(handle))
#define _MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vcapture_cb_lock)
-#define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VCAPTURE_CALLBACK(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_VCAPTURE_CALLBACK_LOCK(handle))
#define _MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).vstream_cb_lock)
-#define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_VSTREAM_CALLBACK(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_VSTREAM_CALLBACK_LOCK(handle))
#define _MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).astream_cb_lock)
-#define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle) g_mutex_lock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle) g_mutex_trylock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
-#define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle) g_mutex_unlock(_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_LOCK_ASTREAM_CALLBACK(handle) pthread_mutex_lock(&_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_TRYLOCK_ASTREAM_CALLBACK(handle) pthread_mutex_trylock(&_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
+#define _MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(handle) pthread_mutex_unlock(&_MMCAMCORDER_GET_ASTREAM_CALLBACK_LOCK(handle))
/**
* Caster of main handle (camcorder)
#define MM_CAMCORDER_MODE_NUM 3 /**< Number of mode type */
#define MM_CAMCORDER_COLOR_TONE_NUM 30 /**< Number of color-tone modes */
#define MM_CAMCORDER_WHITE_BALANCE_NUM 10 /**< Number of WhiteBalance modes*/
-#define MM_CAMCORDER_SCENE_MODE_NUM 15 /**< Number of program-modes */
+#define MM_CAMCORDER_SCENE_MODE_NUM 16 /**< Number of program-modes */
#define MM_CAMCORDER_FOCUS_MODE_NUM 6 /**< Number of focus mode*/
#define MM_CAMCORDER_AUTO_FOCUS_NUM 5 /**< Total count of auto focus type*/
#define MM_CAMCORDER_FOCUS_STATE_NUM 4 /**< Number of focus state */
#define MM_CAMCORDER_ISO_NUM 10 /**< Number of ISO */
#define MM_CAMCORDER_AUTO_EXPOSURE_NUM 9 /**< Number of Auto exposure type */
#define MM_CAMCORDER_WDR_NUM 3 /**< Number of wide dynamic range */
+#define MM_CAMCORDER_FLIP_NUM 4 /**< Number of Filp mode */
+#define MM_CAMCORDER_ROTATION_NUM 4 /**< Number of Rotation mode */
#define MM_CAMCORDER_AHS_NUM 4 /**< Number of anti-handshake */
#define MM_CAMCORDER_VIDEO_STABILIZATION_NUM 2 /**< Number of video stabilization */
#define MM_CAMCORDER_HDR_CAPTURE_NUM 3 /**< Number of HDR capture mode */
_MMCamcorder_MULTI_SHOT,
};
-/**
- * Enumerations for manual focus direction.
- * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
+/**
+ * Enumerations for manual focus direction.
+ * If focusing mode is not "MM_CAMCORDER_AF_MODE_MANUAL", this value will be ignored.
*/
enum MMCamcorderMfLensDir {
MM_CAMCORDER_MF_LENS_DIR_FORWARD = 1, /**< Focus direction to forward */
_MMCAMCORDER_MAIN_PIPE = 0x00,
/* Pipeline element of Video input */
- _MMCAMCORDER_VIDEOSRC_BIN,
_MMCAMCORDER_VIDEOSRC_SRC,
_MMCAMCORDER_VIDEOSRC_FILT,
- _MMCAMCORDER_VIDEOSRC_QUE,
+ _MMCAMCORDER_VIDEOSRC_CLS_QUE,
_MMCAMCORDER_VIDEOSRC_CLS,
- _MMCAMCORDER_VIDEOSRC_SCALE,
- _MMCAMCORDER_VIDEOSRC_VSFLT,
- _MMCAMCORDER_VIDEOSRC_TEE,
+ _MMCAMCORDER_VIDEOSRC_CLS_FILT,
+ _MMCAMCORDER_VIDEOSRC_QUE,
+ _MMCAMCORDER_VIDEOSRC_DECODE,
+
+ /* Pipeline element of Video output */
+ _MMCAMCORDER_VIDEOSINK_QUE,
+ _MMCAMCORDER_VIDEOSINK_CLS,
+ _MMCAMCORDER_VIDEOSINK_SINK,
+
+ _MMCAMCORDER_PIPELINE_ELEMENT_NUM,
+} _MMCAMCORDER_PREVIEW_PIPELINE_ELELMENT;
+
+/**
+ * Camcorder Pipeline's Element name.
+ * @note index of element.
+ */
+typedef enum {
+ _MMCAMCORDER_ENCODE_NONE = (-1),
+
+ /* Main Pipeline Element */
+ _MMCAMCORDER_ENCODE_MAIN_PIPE = 0x00,
/* Pipeline element of Audio input */
_MMCAMCORDER_AUDIOSRC_BIN,
_MMCAMCORDER_AUDIOSRC_SRC,
_MMCAMCORDER_AUDIOSRC_FILT,
- _MMCAMCORDER_AUDIOSRC_NS,
_MMCAMCORDER_AUDIOSRC_QUE,
_MMCAMCORDER_AUDIOSRC_CONV,
_MMCAMCORDER_AUDIOSRC_VOL,
- _MMCAMCORDER_AUDIOSRC_ENC,
-
- /* Pipeline element of Video output */
- _MMCAMCORDER_VIDEOSINK_BIN,
- _MMCAMCORDER_VIDEOSINK_QUE,
- _MMCAMCORDER_VIDEOSINK_SCALE,
- _MMCAMCORDER_VIDEOSINK_FILT,
- _MMCAMCORDER_VIDEOSINK_OVERLAY,
- _MMCAMCORDER_VIDEOSINK_CLS,
- _MMCAMCORDER_VIDEOSINK_ROTATE,
- _MMCAMCORDER_VIDEOSINK_SINK,
/* Pipeline element of Encodebin */
_MMCAMCORDER_ENCSINK_BIN,
+ _MMCAMCORDER_ENCSINK_SRC,
+ _MMCAMCORDER_ENCSINK_FILT,
_MMCAMCORDER_ENCSINK_ENCBIN,
_MMCAMCORDER_ENCSINK_AQUE,
_MMCAMCORDER_ENCSINK_CONV,
_MMCAMCORDER_ENCSINK_MUX,
_MMCAMCORDER_ENCSINK_SINK,
- /* Pipeline element of Stillshot output */
- _MMCAMCORDER_STILLSHOTSINK_BIN,
- _MMCAMCORDER_STILLSHOTSINK_QUE,
- _MMCAMCORDER_STILLSHOTSINK_TOGGLE,
- _MMCAMCORDER_STILLSHOTSINK_CLS,
- _MMCAMCORDER_STILLSHOTSINK_CROP,
- _MMCAMCORDER_STILLSHOTSINK_FILT,
- _MMCAMCORDER_STILLSHOTSINK_SCALE,
- _MMCAMCORDER_STILLSHOTSINK_FILT2,
- _MMCAMCORDER_STILLSHOTSINK_ENC,
- _MMCAMCORDER_STILLSHOTSINK_SINK,
-
- _MMCamcorder_PIPELINE_ELEMENT_NUM,
-} _MMCAMCORDER_PIPELINE_ELELMENT;
+ _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM,
+} _MMCAMCORDER_ENCODE_PIPELINE_ELELMENT;
-/**
- * Command type for Camcorder.
- */
typedef enum {
- _MMCAMCORDER_CMD_CREATE,
- _MMCAMCORDER_CMD_DESTROY,
- _MMCAMCORDER_CMD_REALIZE,
- _MMCAMCORDER_CMD_UNREALIZE,
- _MMCAMCORDER_CMD_START,
- _MMCAMCORDER_CMD_STOP,
- _MMCAMCORDER_CMD_CAPTURESTART,
- _MMCAMCORDER_CMD_CAPTURESTOP,
- _MMCAMCORDER_CMD_RECORD,
- _MMCAMCORDER_CMD_PAUSE,
- _MMCAMCORDER_CMD_COMMIT,
- _MMCAMCORDER_CMD_CANCEL,
- _MMCAMCORDER_CMD_QUIT,
-} _MMCamcorderCommandType;
+ _MMCAMCORDER_TASK_THREAD_STATE_NONE,
+ _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START,
+ _MMCAMCORDER_TASK_THREAD_STATE_ENCODE_PIPE_CREATE,
+ _MMCAMCORDER_TASK_THREAD_STATE_EXIT,
+} _MMCamcorderTaskThreadState;
/**
* System state change cause
* MMCamcorder information for Multi-Thread Safe
*/
typedef struct {
- GMutex *lock; /**< Mutex (for general use) */
- GCond *cond; /**< Condition (for general use) */
- GMutex *cmd_lock; /**< Mutex (for command) */
- GMutex *state_lock; /**< Mutex (for state change) */
- GMutex *gst_state_lock; /**< Mutex (for state change) */
- GMutex *message_cb_lock; /**< Mutex (for message callback) */
- GMutex *vcapture_cb_lock; /**< Mutex (for video capture callback) */
- GMutex *vstream_cb_lock; /**< Mutex (for video stream callback) */
- GMutex *astream_cb_lock; /**< Mutex (for audio stream callback) */
+ pthread_mutex_t lock; /**< Mutex (for general use) */
+ pthread_cond_t cond; /**< Condition (for general use) */
+ pthread_mutex_t cmd_lock; /**< Mutex (for command) */
+ pthread_mutex_t asm_lock; /**< Mutex (for ASM) */
+ pthread_mutex_t state_lock; /**< Mutex (for state change) */
+ pthread_mutex_t gst_state_lock; /**< Mutex (for gst pipeline state change) */
+ pthread_mutex_t gst_encode_state_lock; /**< Mutex (for gst encode pipeline state change) */
+ pthread_mutex_t message_cb_lock; /**< Mutex (for message callback) */
+ pthread_mutex_t vcapture_cb_lock; /**< Mutex (for video capture callback) */
+ pthread_mutex_t vstream_cb_lock; /**< Mutex (for video stream callback) */
+ pthread_mutex_t astream_cb_lock; /**< Mutex (for audio stream callback) */
} _MMCamcorderMTSafe;
-/**
- * MMCamcorder information for command loop
- */
-typedef struct {
- pthread_t pCommandThread; /**< Command loop handle */
- GQueue *cmd_queue; /**< Queue for Command loop */
- sem_t sema; /**< Semaphore for Command loop */
-} _MMCamcorderCommand;
-
-/**
- * MMCamcorder command information
- */
-typedef struct {
- MMHandleType handle; /**< camcorder handle */
- _MMCamcorderCommandType type; /**< Type of command */
-} __MMCamcorderCmdInfo;
/**
* MMCamcorder Sub Context
bool isMaxsizePausing; /**< Because of size limit, pipeline is paused. */
bool isMaxtimePausing; /**< Because of time limit, pipeline is paused. */
int element_num; /**< count of element */
+ int encode_element_num; /**< count of encode element */
int cam_stability_count; /**< camsensor stability count. the count of frame will drop */
GstClockTime pipeline_time; /**< current time of Gstreamer Pipeline */
GstClockTime pause_time; /**< amount of time while pipeline is in PAUSE state.*/
int pass_first_vframe; /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */
/* INI information */
- gchar format_name[sizeof(GST_VIDEO_FORMATS_ALL)]; /**< Get format value of camera INI file */
+ unsigned int fourcc; /**< Get fourcc value of camera INI file */
_MMCamcorderImageInfo *info_image; /**< extra information for image capture */
_MMCamcorderVideoInfo *info_video; /**< extra information for video recording */
_MMCamcorderAudioInfo *info_audio; /**< extra information for audio recording */
- _MMCamcorderGstElement *element; /**< array of Gstreamer element */
+ _MMCamcorderGstElement *element; /**< array of preview element */
+ _MMCamcorderGstElement *encode_element; /**< array of encode element */
_MMCamcorderKPIMeasure kpi; /**< information related with performance measurement */
type_element *VideosinkElement; /**< configure data of videosink element */
+ type_element *VideoconvertElement; /**< configure data of videoconvert element */
gboolean SensorEncodedCapture; /**< whether camera sensor support encoded image capture */
gboolean internal_encode; /**< whether use internal encoding function */
} _MMCamcorderSubContext;
typedef struct mmf_camcorder {
/* information */
int type; /**< mmcamcorder_mode_type */
+ int device_type; /**< device type */
int state; /**< state of camcorder */
int target_state; /**< Target state that want to set. This is a flag that
* stands for async state changing. If this value differ from state,
mm_exif_info_t *exif_info; /**< EXIF */
GList *buffer_probes; /**< a list of buffer probe handle */
GList *event_probes; /**< a list of event probe handle */
- GList *data_probes; /**< a list of data probe handle */
GList *signals; /**< a list of signal handle */
GList *msg_data; /**< a list of msg data */
camera_conf *conf_main; /**< Camera configure Main structure */
camera_conf *conf_ctrl; /**< Camera configure Control structure */
- int asm_handle_sh; /**< Audio session manager handle of share session */
- int asm_handle_ex; /**< Audio session manager handle of exclusive session */
guint pipeline_cb_event_id; /**< Event source ID of pipeline message callback */
+ guint encode_pipeline_cb_event_id; /**< Event source ID of encode pipeline message callback */
guint setting_event_id; /**< Event source ID of attributes setting to sensor */
SOUND_INFO snd_info; /**< Sound handle for multishot capture */
int (*command)(MMHandleType, int); /**< camcorder's command */
/* etc */
+ mm_cam_attr_construct_info *cam_attrs_const_info; /**< attribute info */
+ conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table - MAIN category */
+ conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table - CONTROL category */
+ int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM]; /** configure info table size - MAIN category */
+ int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM]; /** configure info table size - CONTROL category */
_MMCamcorderMTSafe mtsafe; /**< Thread safe */
- _MMCamcorderCommand cmd; /**< information for command loop */
- int sync_state_change; /**< Change framework state synchronously */
- int quick_device_close;
- int state_change_by_system; /**< MSL changes its state by itself because of system(ASM,MDM..) **/
- int asm_event_code; /**< event code of audio session manager */
+ int state_change_by_system; /**< MSL changes its state by itself because of system */
pthread_mutex_t sound_lock; /**< Capture sound mutex */
pthread_cond_t sound_cond; /**< Capture sound cond */
+ pthread_mutex_t restart_preview_lock; /**< Capture sound mutex */
int use_zero_copy_format; /**< Whether use zero copy format for camera input */
+ int support_media_packet_preview_cb; /**< Whether support zero copy format for camera input */
int shutter_sound_policy; /**< shutter sound policy */
+ int brightness_default; /**< default value of brightness */
+ int brightness_step_denominator; /**< denominator of brightness bias step */
+ int support_zsl_capture; /**< support Zero Shutter Lag capture */
+ char *model_name; /**< model name from system info */
+ char *software_version; /**< software_version from system info */
+ int capture_sound_count; /**< count for capture sound */
+ bool stillshot_wide_resolution; /**<to set the capture resolution high*/
_MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM]; /**< converting structure of camera info */
_MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM]; /**< enum converting list that is modified by ini info */
- int reserved[4]; /**< reserved */
+ gboolean capture_in_recording; /**< Flag for capture while recording */
+
+ /* task thread */
+ pthread_t task_thread; /**< thread for task */
+ pthread_mutex_t task_thread_lock; /**< mutex for task thread */
+ pthread_cond_t task_thread_cond; /**< cond for task thread */
+ _MMCamcorderTaskThreadState task_thread_state; /**< state of task thread */
+
+ int reserved[4]; /**< reserved */
} mmf_camcorder_t;
/*=======================================================================================
int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info);
/**
- * This function destroys instance of camcorder.
+ * This function destroys instance of camcorder.
*
* @param[in] hcamcorder Specifies the camcorder handle
* @return This function returns zero on success, or negative value with error code.
void _mmcamcorder_set_state(MMHandleType handle, int state);
/**
- * This function gets asynchronous status of MSL Camcroder.
+ * This function gets asynchronous status of MSL Camcroder.
*
* @param[in] handle Handle of camcorder context.
* @param[in] target_state setting target_state value of camcorder.
int _mmcamcorder_get_async_state(MMHandleType handle);
/**
- * This function sets new target state of camcorder.
- *
- * @param[in] handle Handle of camcorder context.
- * @param[in] target_state setting target_state value of camcorder.
- * @return This function returns zero on success, or negative value with error code.
- * @remarks
- * @see _mmcamcorder_get_async_state(), _mmcamcorder_set_async_cancel()
- *
- */
-int _mmcamcorder_set_async_state(MMHandleType handle, int target_state);
-
-/**
- * This function sets new target state of camcorder.
- *
- * @param[in] handle Handle of camcorder context.
- * @return gboolean
- * @remarks
- * @see _mmcamcorder_set_async_cancel()
- *
- */
-gboolean _mmcamcorder_set_async_cancel(MMHandleType handle);
-
-/**
- * Check whether camcorder changes its state now.
- *
- * @param[in] handle Handle of camcorder context.
- * @return gboolean
- * @remarks
- * @see _mmcamcorder_set_async_state(), _mmcamcorder_set_async_cancel()
- *
- */
-gboolean _mmcamcorder_is_state_changing(MMHandleType handle);
-
-/**
* This function allocates structure of subsidiary attributes.
*
* @param[in] type Allocation type of camcorder context.
void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type);
/**
- * This function sets gstreamer element status.
+ * This function sets gstreamer element status.
* If the gstreamer fails to set status or returns asynchronous mode,
* this function waits for state changed until timeout expired.
*
int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state);
/**
- * This function sets gstreamer element status, asynchronously.
+ * This function sets gstreamer element status, asynchronously.
* Regardless of processing, it returns immediately.
*
* @param[in] pipeline Pointer of pipeline
* @param[in] target_state newly setting status
* @return This function returns zero on success, or negative value with error code.
* @remarks
- * @see
+ * @see
*
*/
int _mmcamcorder_gst_set_state_async(MMHandleType handle, GstElement *pipeline, GstState target_state);
int _mmcamcorder_video_current_framerate(MMHandleType handle);
int _mmcamcorder_video_average_framerate(MMHandleType handle);
-/* command */
-void _mmcamcorder_delete_command_info(__MMCamcorderCmdInfo *cmdinfo);
-int _mmcamcorder_create_command_loop(MMHandleType handle);
-int _mmcamcorder_destroy_command_loop(MMHandleType handle);
-int _mmcamcorder_append_command(MMHandleType handle, __MMCamcorderCmdInfo *info);
-int _mmcamcorder_append_simple_command(MMHandleType handle, _MMCamcorderCommandType type);
-void *_mmcamcorder_command_loop_thread(void *arg);
-
#ifdef __cplusplus
}
#endif
#define _MMCAMCORDER_SENSOR_ENUM_NONE -255
/* camera information related */
-#define CAMINFO_CONVERT_NUM 40
+#define CAMINFO_CONVERT_NUM 41
/*=======================================================================================
ENUM_CONVERT_EXPOSURE_MODE,
ENUM_CONVERT_STROBE_MODE,
ENUM_CONVERT_WDR,
+ ENUM_CONVERT_FLIP,
+ ENUM_CONVERT_ROTATION,
ENUM_CONVERT_ANTI_HAND_SHAKE,
ENUM_CONVERT_VIDEO_STABILIZATION,
ENUM_CONVERT_NUM
int total_enum_num; /**< total enumeration count */
int *enum_arr; /**< enumeration array */
int category; /**< category */
- char *keyword; /**< keyword array */
+ const char *keyword; /**< keyword array */
} _MMCamcorderEnumConvert;
int category; /**< category of configuration */
int attr_idx; /**< attribute index */
int attr_idx_pair; /**< attribute index (only for 'pair' type) */
- char *keyword;
+ const char *keyword;
MMCamConvertingType conv_type;
_MMCamcorderEnumConvert *enum_convert; /**< converting value table */
} _MMCamcorderInfoConverting;
| INCLUDE FILES |
========================================================================================*/
#include <pulse/pulseaudio.h>
+#include <pulse/ext-policy.h>
#ifdef __cplusplus
extern "C" {
/*=======================================================================================
| MACRO DEFINITIONS |
========================================================================================*/
-#define _MMCAMCORDER_FILEPATH_CAPTURE_SND "/usr/share/sounds/mm-camcorder/capture_shutter_01.wav"
-#define _MMCAMCORDER_FILEPATH_CAPTURE2_SND "/usr/share/sounds/mm-camcorder/capture_shutter_02.wav"
-#define _MMCAMCORDER_FILEPATH_REC_START_SND "/usr/share/sounds/mm-camcorder/recording_start_01.wav"
-#define _MMCAMCORDER_FILEPATH_REC_STOP_SND "/usr/share/sounds/mm-camcorder/recording_stop_01.wav"
-#define _MMCAMCORDER_FILEPATH_AF_SUCCEED_SND "/usr/share/sounds/mm-camcorder/af_succeed.wav"
-#define _MMCAMCORDER_FILEPATH_AF_FAIL_SND "/usr/share/sounds/mm-camcorder/af_fail.wav"
-#define _MMCAMCORDER_FILEPATH_NO_SND "/usr/share/sounds/mm-camcorder/no_sound.wav"
+#define _MMCAMCORDER_FILEPATH_CAPTURE_SND "/usr/share/sounds/mm-camcorder/capture_shutter_01.wav"
+#define _MMCAMCORDER_FILEPATH_CAPTURE2_SND "/usr/share/sounds/mm-camcorder/capture_shutter_02.wav"
+#define _MMCAMCORDER_FILEPATH_REC_START_SND "/usr/share/sounds/mm-camcorder/recording_start_01.wav"
+#define _MMCAMCORDER_FILEPATH_REC_STOP_SND "/usr/share/sounds/mm-camcorder/recording_stop_01.wav"
+#define _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE "camera-shutter"
+#define _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP "recording-stop"
/*=======================================================================================
| ENUM DEFINITIONS |
/* PCM */
MMSoundPcmHandle_t handle;
mm_sound_device_out active_out_backup;
+ int volume_type;
+ unsigned int volume_level;
/* mutex and cond */
pthread_mutex_t play_mutex;
pa_sample_spec sample_spec;
size_t sample_length;
pa_channel_map channel_map;
-#endif
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+ pa_stream *sample_stream;
+ pa_sample_spec sample_spec;
+#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
_MMCamcorderSoundState state;
} SOUND_INFO;
#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
gboolean _mmcamcorder_sound_init(MMHandleType handle);
#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
-gboolean _mmcamcorder_sound_play(MMHandleType handle);
+gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, gboolean sync_play);
gboolean _mmcamcorder_sound_finalize(MMHandleType handle);
-gboolean _mmcamcorder_sound_capture_play_cb(gpointer data);
-void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync);
+void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync_play);
+void _mmcamcorder_sound_solo_play_wait(MMHandleType handle);
#ifdef __cplusplus
}
/*=======================================================================================
| ENUM DEFINITIONS |
========================================================================================*/
-/**
- * Enumeration for flip of fimcconvert
- */
-enum {
- FIMCCONVERT_FLIP_NONE = 0,
- FIMCCONVERT_FLIP_VERTICAL,
- FIMCCONVERT_FLIP_HORIZONTAL
-};
+
/*=======================================================================================
| STRUCTURE DEFINITIONS |
* @remarks
* @see __mmcamcorder_create_preview_pipeline()
*/
-int _mmcamcorder_add_stillshot_pipeline(MMHandleType handle);
+int _mmcamcorder_create_stillshot_pipeline(MMHandleType handle);
/**
* This function remove still shot bin from main pipeline.
*/
void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle);
int _mmcamcorder_video_capture_command(MMHandleType handle, int command);
-int _mmcamcorder_set_resize_property(MMHandleType handle, int capture_width, int capture_height);
/* Function for capture */
int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int image_height);
+int __mmcamcorder_update_exif_info(MMHandleType handle,void* imagedata, int imgln);
void __mmcamcorder_init_stillshot_info(MMHandleType handle);
void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstSample *sample);
void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest);
int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureDataType *original, MMCamcorderCaptureDataType *thumbnail);
int __mmcamcorder_set_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest, MMCamcorderCaptureDataType *thumbnail);
+gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data);
#ifdef __cplusplus
}
/*=======================================================================================
| INCLUDE FILES |
========================================================================================*/
+#include <camsrcjpegenc.h>
+#include <linux/magic.h>
+
#ifdef __cplusplus
extern "C" {
} else { \
item->object = G_OBJECT(x_pad); \
item->category = x_category; \
- item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hcamcorder, NULL); \
+ item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hcamcorder, NULL); \
x_hcamcorder->buffer_probes = g_list_append(x_hcamcorder->buffer_probes, item); \
_mmcam_dbg_log("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
} \
} else { \
item->object =G_OBJECT(x_pad); \
item->category = x_category; \
- item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hcamcorder, NULL); \
+ item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hcamcorder, NULL); \
x_hcamcorder->event_probes = g_list_append(x_hcamcorder->event_probes, item); \
_mmcam_dbg_log("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
} \
} while (0);
-#define MMCAMCORDER_ADD_DATA_PROBE(x_pad, x_category, x_callback, x_hcamcorder) \
-do { \
- MMCamcorderHandlerItem *item = NULL; \
- item = (MMCamcorderHandlerItem *) g_malloc(sizeof(MMCamcorderHandlerItem)); \
- if (!item) { \
- _mmcam_dbg_err("Cannot connect buffer probe [malloc fail] \n"); \
- } else if (x_category == 0 || !(x_category & _MMCAMCORDER_HANDLER_CATEGORY_ALL)) { \
- _mmcam_dbg_err("Invalid handler category : %x \n", x_category); \
- } else { \
- item->object =G_OBJECT(x_pad); \
- item->category = x_category; \
- item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_DATA_BOTH, x_callback, x_hcamcorder, NULL); \
- x_hcamcorder->data_probes = g_list_append(x_hcamcorder->data_probes, item); \
- _mmcam_dbg_log("Adding data probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
- } \
-} while (0);
-
#define MMCAMCORDER_SIGNAL_CONNECT( x_object, x_category, x_signal, x_callback, x_hcamcorder) \
do { \
MMCamcorderHandlerItem* item = NULL; \
MMHandleType handle; /**< handle */
int id; /**< message id */
MMMessageParamType param; /**< message parameter */
+ pthread_mutex_t lock; /**< mutex for item */
} _MMCamcorderMsgItem;
/**
int __dummy2;
/* arbitrary data */
int data[16];
+ /* dmabuf or ion fd */
+ int fd[SCMN_IMGB_MAX_PLANE];
+ /* flag for buffer share */
+ int buf_share_method;
+ /* Y plane size */
+ int y_size;
+ /* UV plane size */
+ int uv_size;
+ /* Tizen buffer object of each image plane */
+ void *bo[SCMN_IMGB_MAX_PLANE];
} SCMN_IMGB;
/*=======================================================================================
| CONSTANT DEFINITIONS |
========================================================================================*/
+#define FAT32_FILE_SYSTEM_MAX_SIZE (4294967295UL) /* 4 GigaByte - 1 byte */
+#define NANO_SEC_PER_MILI_SEC 1000000
#define _MMCAMCORDER_HANDLER_CATEGORY_ALL \
(_MMCAMCORDER_HANDLER_PREVIEW | _MMCAMCORDER_HANDLER_VIDEOREC |_MMCAMCORDER_HANDLER_STILLSHOT | _MMCAMCORDER_HANDLER_AUDIOREC)
========================================================================================*/
/* GStreamer */
void _mmcamcorder_remove_buffer_probe(MMHandleType handle, _MMCamcorderHandlerCategory category);
+void _mmcamcorder_remove_one_buffer_probe(MMHandleType handle, void *object);
void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCategory category);
-void _mmcamcorder_remove_data_probe(MMHandleType handle, _MMCamcorderHandlerCategory category);
void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCategory category);
void _mmcamcorder_remove_all_handlers(MMHandleType handle, _MMCamcorderHandlerCategory category);
void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_was);
/* JPEG encode */
gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsigned int src_height,
int src_format, unsigned int src_length, unsigned int jpeg_quality,
- void **result_data, unsigned int *result_length);
+ void **result_data, unsigned int *result_length, int enc_type);
/* resize */
-gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int src_height, int src_length, int src_format,
- unsigned char **dst_data, int *dst_width, int *dst_height, int *dst_length);
+gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_width, unsigned int src_height, unsigned int src_length, int src_format,
+ unsigned char **dst_data, unsigned int *dst_width, unsigned int *dst_height, unsigned int *dst_length);
+gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_width, unsigned int src_height,
+ unsigned char **dst, unsigned int dst_width, unsigned int dst_height);
/* Recording */
/* find top level tag only, do not use this function for finding sub level tags.
/* File system */
int _mmcamcorder_get_freespace(const gchar *path, guint64 *free_space);
int _mmcamcorder_get_file_size(const char *filename, guint64 *size);
+int _mmcamcorder_get_file_system_type(const gchar *path, int *file_system_type);
+gboolean _mmcamcorder_check_file_path(const gchar *path);
-/* Debug */
-void _mmcamcorder_err_trace_write(char *str_filename, char *func_name, int line_num, char *fmt, ...);
+/* Task */
+void *_mmcamcorder_util_task_thread_func(void *data);
#ifdef __cplusplus
}
/*=======================================================================================
| ENUM DEFINITIONS |
========================================================================================*/
+enum {
+ PUSH_ENCODING_BUFFER_INIT = 0,
+ PUSH_ENCODING_BUFFER_RUN,
+ PUSH_ENCODING_BUFFER_STOP,
+};
/*=======================================================================================
| STRUCTURE DEFINITIONS |
typedef struct {
gboolean b_commiting; /**< Is it commiting now? */
char *filename; /**< recorded filename */
- double record_timestamp_ratio; /**< timestamp ratio of video recording for slow motion recording */
+ double record_timestamp_ratio; /**< timestamp ratio of video recording for slow/fast motion recording */
+ double record_motion_rate; /**< motion rate of video recording for slow/fast motion recording */
+ GstClockTime prev_preview_ts; /**< previous preview frame timestamp */
+ GstClockTime base_video_ts; /**< base video frame timestamp */
+ guint record_drop_count; /**< drop count of video recording for slow/fast motion recording */
guint64 video_frame_count; /**< current video frame */
guint64 audio_frame_count; /**< current audio frame */
guint64 filesize; /**< current file size */
guint64 max_size; /**< max recording size */
guint64 max_time; /**< max recording time */
int fileformat; /**< recording file format */
-/*
- guint checker_id;
- guint checker_count;
-*/
+ int push_encoding_buffer; /**< ready to record flag */
+ int preview_width; /**< preview width */
+ int preview_height; /**< preview height */
+ int video_width; /**< video width */
+ int video_height; /**< video height */
+ int fps; /**< fps in videosrc caps */
+ gboolean is_firstframe;
+ gboolean get_first_I_frame; /**< start flag for H.264 preview recording */
+ gboolean support_dual_stream; /**< support dual stream flag */
+ gboolean record_dual_stream; /**< record with dual stream flag */
+ gboolean restart_preview; /**< flag for whether restart preview or not when start recording */
+ pthread_mutex_t size_check_lock;/**< mutex for checking recording size */
} _MMCamcorderVideoInfo;
/*=======================================================================================
| GLOBAL FUNCTION PROTOTYPES |
========================================================================================*/
/**
- * This function add recorder bin to main pipeline.
+ * This function creates recorder pipeline.
* When application creates initial pipeline, there are only bins for preview.
- * If application wants to add recording function, bins for recording should be added.
+ * If application wants to record, recorder pipeline should be created.
*
* @param[in] handle Handle of camcorder context.
* @return This function returns MM_ERROR_NONE on success, or the other values on error.
* @remarks
* @see __mmcamcorder_create_preview_pipeline()
*/
-int _mmcamcorder_add_recorder_pipeline(MMHandleType handle);
+int _mmcamcorder_create_recorder_pipeline(MMHandleType handle);
/**
- * This function remove recorder bin from main pipeline.
+ * This function connects video stream cb signal.
*
* @param[in] handle Handle of camcorder context.
* @return This function returns MM_ERROR_NONE on success, or the other values on error.
* @remarks
- * @see __mmcamcorder_create_preview_pipeline(), __mmcamcorder_add_recorder_pipeline()
*/
-int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle);
+int _mmcamcorder_connect_video_stream_cb_signal(MMHandleType handle);
/**
- * This function destroy video pipeline.
+ * This function remove recorder bin from main pipeline.
*
* @param[in] handle Handle of camcorder context.
- * @return void
+ * @return This function returns MM_ERROR_NONE on success, or the other values on error.
* @remarks
- * @see _mmcamcorder_destroy_pipeline()
+ * @see __mmcamcorder_create_preview_pipeline(), __mmcamcorder_add_recorder_pipeline()
*/
-void _mmcamcorder_destroy_video_pipeline(MMHandleType handle);
+int _mmcamcorder_remove_recorder_pipeline(MMHandleType handle);
/**
* This function operates each command on video mode.
*/
int _mmcamcorder_video_handle_eos(MMHandleType handle);
+/**
+ * This function prepares video recording
+ *
+ * @param[in] handle Handle of camcorder context.
+ * @return This function returns MM_ERROR_NONE on success, or the other values on error.
+ * @remarks
+ */
+int _mmcamcorder_video_prepare_record(MMHandleType handle);
+
#ifdef __cplusplus
}
#include <stdio.h>
#include <string.h>
-
#include <mm_error.h>
-#include <mm_ta.h>
-
#include <mm_attrs_private.h>
+
#include "mm_camcorder.h"
#include "mm_camcorder_internal.h"
_mmcam_dbg_err("");
- MMTA_INIT() ;
-
- __ta__("_mmcamcorder_create",
error = _mmcamcorder_create(camcorder, info);
- );
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- __ta__("_mmcamcorder_destroy",
error = _mmcamcorder_destroy(camcorder);
- );
-
- MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE);
- MMTA_RELEASE();
_mmcam_dbg_err("END!!!");
_mmcam_dbg_err("");
- if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
- __ta__("_mmcamcorder_realize",
- error = _mmcamcorder_realize(camcorder);
- );
- } else {
- /* After sending command, this function just return immediately. */
- error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_REALIZE);
- }
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
+ error = _mmcamcorder_realize(camcorder);
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
- __ta__("_mmcamcorder_unrealize",
- error = _mmcamcorder_unrealize(camcorder);
- );
- } else {
- /* After sending command, this function just return immediately. */
- error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_UNREALIZE);
- }
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
+ error = _mmcamcorder_unrealize(camcorder);
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
- __ta__("_mmcamcorder_start",
- error = _mmcamcorder_start(camcorder);
- );
- } else {
- /* After sending command, this function just return immediately. */
- error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_START);
- }
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
+ error = _mmcamcorder_start(camcorder);
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
- __ta__("_mmcamcorder_stop",
- error = _mmcamcorder_stop(camcorder);
- );
- } else {
- /* After sending command, this function just return immediately. */
- error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_STOP);
- }
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
+ error = _mmcamcorder_stop(camcorder);
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- __ta__("_mmcamcorder_capture_start",
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
error = _mmcamcorder_capture_start(camcorder);
- );
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- __ta__("_mmcamcorder_capture_stop",
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
error = _mmcamcorder_capture_stop(camcorder);
- );
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- __ta__("_mmcamcorder_record",
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
error = _mmcamcorder_record(camcorder);
- );
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- __ta__("_mmcamcorder_pause",
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
error = _mmcamcorder_pause(camcorder);
- );
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- MMTA_ACUM_ITEM_BEGIN("Real Commit Time", 0);
+ _MMCAMCORDER_LOCK_ASM(camcorder);
- if(((mmf_camcorder_t *)camcorder)->sync_state_change) {
- __ta__("_mmcamcorder_stop",
- error = _mmcamcorder_commit(camcorder);
- );
- } else {
- /* After sending command, this function just return immediately. */
- error = _mmcamcorder_append_simple_command(camcorder, _MMCAMCORDER_CMD_COMMIT);
- }
+ error = _mmcamcorder_commit(camcorder);
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
_mmcam_dbg_err("");
- __ta__("_mmcamcorder_cancel",
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
error = _mmcamcorder_cancel(camcorder);
- );
+
+ _MMCAMCORDER_UNLOCK_ASM(camcorder);
_mmcam_dbg_err("END");
int mm_camcorder_set_message_callback(MMHandleType camcorder, MMMessageCallback callback, void *user_data)
{
- int error = MM_ERROR_NONE;
-
mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
- error = _mmcamcorder_set_message_callback(camcorder, callback, user_data);
-
- return error;
+ return _mmcamcorder_set_message_callback(camcorder, callback, user_data);
}
int mm_camcorder_set_video_stream_callback(MMHandleType camcorder, mm_camcorder_video_stream_callback callback, void* user_data)
{
- int error = MM_ERROR_NONE;
-
mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
- error = _mmcamcorder_set_video_stream_callback(camcorder, callback, user_data);
-
- return error;
+ return _mmcamcorder_set_video_stream_callback(camcorder, callback, user_data);
}
int mm_camcorder_set_audio_stream_callback(MMHandleType camcorder, mm_camcorder_audio_stream_callback callback, void* user_data)
{
- int error = MM_ERROR_NONE;
-
mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
- error = _mmcamcorder_set_audio_stream_callback(camcorder, callback, user_data);
-
- return error;
+ return _mmcamcorder_set_audio_stream_callback(camcorder, callback, user_data);
}
int mm_camcorder_set_video_capture_callback(MMHandleType camcorder, mm_camcorder_video_capture_callback callback, void* user_data)
{
- int error = MM_ERROR_NONE;
-
mmf_return_val_if_fail((void *)camcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
- error = _mmcamcorder_set_video_capture_callback(camcorder, callback, user_data);
-
- return error;
+ return _mmcamcorder_set_video_capture_callback(camcorder, callback, user_data);
}
va_start (var_args, attribute_name);
ret = _mmcamcorder_set_attributes(camcorder, err_attr_name, attribute_name, var_args);
va_end (var_args);
-
+
return ret;
}
return error;
}
-
| INCLUDE FILES |
=======================================================================================*/
#include "mm_camcorder_internal.h"
+#include "mm_camcorder_gstcommon.h"
#include <gst/video/colorbalance.h>
#include <gst/video/cameracontrol.h>
/*---------------------------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS for internal |
---------------------------------------------------------------------------------------*/
-int depth[] = {MM_CAMCORDER_AUDIO_FORMAT_PCM_U8,
- MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE};
-
-int visible_values[] = { 0, 1 }; /*0: off, 1:on*/
-
-int strobe_mode[] = {MM_CAMCORDER_STROBE_MODE_OFF,
- MM_CAMCORDER_STROBE_MODE_ON,
- MM_CAMCORDER_STROBE_MODE_AUTO,
- MM_CAMCORDER_STROBE_MODE_REDEYE_REDUCTION,
- MM_CAMCORDER_STROBE_MODE_SLOW_SYNC,
- MM_CAMCORDER_STROBE_MODE_FRONT_CURTAIN,
- MM_CAMCORDER_STROBE_MODE_REAR_CURTAIN,
- MM_CAMCORDER_STROBE_MODE_PERMANENT};
-
-int tag_enable_values[] = { 0, 1 };
-
-int tag_orientation_values[] =
-{
- 1, /*The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.*/
- 2, /*the 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.*/
- 3, /*the 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.*/
- 4, /*the 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.*/
- 5, /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual top.*/
- 6, /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual top.*/
- 7, /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.*/
- 8, /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.*/
-};
-
-
-/* basic attributes' info */
-mm_cam_attr_construct_info cam_attrs_const_info[] ={
- //0
- {
- MM_CAM_MODE, /* ID */
- "mode", /* Name */
- MMF_VALUE_TYPE_INT, /* Type */
- MM_ATTRS_FLAG_RW, /* Flag */
- {(void*)MM_CAMCORDER_MODE_VIDEO_CAPTURE}, /* Default value */
- MM_ATTRS_VALID_TYPE_INT_RANGE, /* Validity type */
- MM_CAMCORDER_MODE_VIDEO_CAPTURE, /* Validity val1 (min, *array,...) */
- MM_CAMCORDER_MODE_AUDIO, /* Validity val2 (max, count, ...) */
- NULL, /* Runtime setting function of the attribute */
- },
- // 1
- {
- MM_CAM_AUDIO_DEVICE,
- "audio-device",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_AUDIO_DEVICE_MIC},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- MM_AUDIO_DEVICE_NUM-1,
- NULL,
- },
- // 2
- {
- MM_CAM_CAMERA_DEVICE_COUNT,
- "camera-device-count",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_VIDEO_DEVICE_NUM},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_VIDEO_DEVICE_NONE,
- MM_VIDEO_DEVICE_NUM,
- NULL,
- },
- // 3
- {
- MM_CAM_AUDIO_ENCODER,
- "audio-encoder",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_AUDIO_CODEC_AMR},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)NULL,
- 0,
- NULL,
- },
- // 4
- {
- MM_CAM_VIDEO_ENCODER,
- "video-encoder",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_VIDEO_CODEC_MPEG4},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)NULL,
- 0,
- NULL,
- },
- //5
- {
- MM_CAM_IMAGE_ENCODER,
- "image-encoder",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_IMAGE_CODEC_JPEG},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)NULL,
- 0,
- NULL,
- },
- //6
- {
- MM_CAM_FILE_FORMAT,
- "file-format",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_FILE_FORMAT_MP4},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)NULL,
- 0,
- NULL,
- },
- //7
- {
- MM_CAM_CAMERA_DEVICE_NAME,
- "camera-device-name",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //8
- {
- MM_CAM_AUDIO_SAMPLERATE,
- "audio-samplerate",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)8000},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //9
- {
- MM_CAM_AUDIO_FORMAT,
- "audio-format",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)depth,
- ARRAY_SIZE(depth),
- NULL,
- },
- //10
- {
- MM_CAM_AUDIO_CHANNEL,
- "audio-channel",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)2},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 1,
- 2,
- NULL,
- },
- //11
- {
- MM_CAM_AUDIO_VOLUME,
- "audio-volume",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)1},
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- 0,
- 10.0,
- _mmcamcorder_commit_audio_volume,
- },
- //12
- {
- MM_CAM_AUDIO_INPUT_ROUTE,
- "audio-input-route",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_AUDIOROUTE_USE_EXTERNAL_SETTING,
- MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY,
- _mmcamcorder_commit_audio_input_route,
- },
- //13
- {
- MM_CAM_FILTER_SCENE_MODE,
- "filter-scene-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_filter_scene_mode,
- },
- //14
- {
- MM_CAM_FILTER_BRIGHTNESS,
- "filter-brightness",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)1},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_filter,
- },
- //15
- {
- MM_CAM_FILTER_CONTRAST,
- "filter-contrast",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_filter,
- },
- //16
- {
- MM_CAM_FILTER_WB,
- "filter-wb",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_filter,
- },
- //17
- {
- MM_CAM_FILTER_COLOR_TONE,
- "filter-color-tone",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_filter,
- },
- //18
- {
- MM_CAM_FILTER_SATURATION,
- "filter-saturation",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_filter,
- },
- //19
- {
- MM_CAM_FILTER_HUE,
- "filter-hue",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_filter,
- },
- //20
- {
- MM_CAM_FILTER_SHARPNESS,
- "filter-sharpness",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_filter,
- },
- //21
- {
- MM_CAM_CAMERA_FORMAT,
- "camera-format",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_PIXEL_FORMAT_YUYV},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- NULL,
- },
- //22
- {
- MM_CAM_CAMERA_RECORDING_MOTION_RATE,
- "camera-recording-motion-rate",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)1},
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_recording_motion_rate,
- },
- //23
- {
- MM_CAM_CAMERA_FPS,
- "camera-fps",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)30},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_fps,
- },
- //24
- {
- MM_CAM_CAMERA_WIDTH,
- "camera-width",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_width,
- },
- //25
- {
- MM_CAM_CAMERA_HEIGHT,
- "camera-height",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_height,
- },
- //26
- {
- MM_CAM_CAMERA_DIGITAL_ZOOM,
- "camera-digital-zoom",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)10},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_camera_zoom,
- },
- //27
- {
- MM_CAM_CAMERA_OPTICAL_ZOOM,
- "camera-optical-zoom",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_camera_zoom,
- },
- //28
- {
- MM_CAM_CAMERA_FOCUS_MODE,
- "camera-focus-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_CAMCORDER_FOCUS_MODE_NONE},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_focus_mode,
- },
- //29
- {
- MM_CAM_CAMERA_AF_SCAN_RANGE,
- "camera-af-scan-range",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_af_scan_range,
- },
- //30
- {
- MM_CAM_CAMERA_EXPOSURE_MODE,
- "camera-exposure-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_capture_mode,
- },
- //31
- {
- MM_CAM_CAMERA_EXPOSURE_VALUE,
- "camera-exposure-value",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_camera_capture_mode,
- },
- //32
- {
- MM_CAM_CAMERA_F_NUMBER,
- "camera-f-number",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_capture_mode,
- },
- //33
- {
- MM_CAM_CAMERA_SHUTTER_SPEED,
- "camera-shutter-speed",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_capture_mode,
- },
- //34
- {
- MM_CAM_CAMERA_ISO,
- "camera-iso",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_capture_mode,
- },
- //35
- {
- MM_CAM_CAMERA_WDR,
- "camera-wdr",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_wdr,
- },
- //36
- {
- MM_CAM_CAMERA_ANTI_HANDSHAKE,
- "camera-anti-handshake",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_anti_handshake,
- },
- //37
- {
- MM_CAM_CAMERA_FPS_AUTO,
- "camera-fps-auto",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- NULL,
- },
- //38
- {
- MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING,
- "camera-hold-af-after-capturing",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- _mmcamcorder_commit_camera_hold_af_after_capturing,
- },
- //39
- {
- MM_CAM_CAMERA_DELAY_ATTR_SETTING,
- "camera-delay-attr-setting",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- NULL,
- },
- //40
- {
- MM_CAM_AUDIO_ENCODER_BITRATE,
- "audio-encoder-bitrate",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //41
- {
- MM_CAM_VIDEO_ENCODER_BITRATE,
- "video-encoder-bitrate",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //42
- {
- MM_CAM_IMAGE_ENCODER_QUALITY,
- "image-encoder-quality",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)95},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_image_encoder_quality,
- },
- //43
- {
- MM_CAM_CAPTURE_FORMAT,
- "capture-format",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_PIXEL_FORMAT_ENCODED},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- NULL,
- },
- //44
- {
- MM_CAM_CAPTURE_WIDTH,
- "capture-width",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)1600},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_capture_width ,
- },
- //45
- {
- MM_CAM_CAPTURE_HEIGHT,
- "capture-height",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)1200},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_capture_height,
- },
- //46
- {
- MM_CAM_CAPTURE_COUNT,
- "capture-count",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)1},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_capture_count,
- },
- //47
- {
- MM_CAM_CAPTURE_INTERVAL,
- "capture-interval",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //48
- {
- MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
- "capture-break-cont-shot",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- _mmcamcorder_commit_capture_break_cont_shot,
- },
- //49
- {
- MM_CAM_DISPLAY_HANDLE,
- "display-handle",
- MMF_VALUE_TYPE_DATA,
- MM_ATTRS_FLAG_RW,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- _mmcamcorder_commit_display_handle,
- },
- //50
- {
- MM_CAM_DISPLAY_DEVICE,
- "display-device",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_DISPLAY_DEVICE_MAINLCD},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- NULL,
- },
- //51
- {
- MM_CAM_DISPLAY_SURFACE,
- "display-surface",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_DISPLAY_SURFACE_X},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- NULL,
- },
- //52
- {
- MM_CAM_DISPLAY_RECT_X,
- "display-rect-x",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_display_rect,
- },
- //53
- {
- MM_CAM_DISPLAY_RECT_Y,
- "display-rect-y",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_display_rect,
- },
- //54
- {
- MM_CAM_DISPLAY_RECT_WIDTH,
- "display-rect-width",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_display_rect,
- },
- //55
- {
- MM_CAM_DISPLAY_RECT_HEIGHT,
- "display-rect-height",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_display_rect,
- },
- //56
- {
- MM_CAM_DISPLAY_SOURCE_X,
- "display-src-x",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //57
- {
- MM_CAM_DISPLAY_SOURCE_Y,
- "display-src-y",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //58
- {
- MM_CAM_DISPLAY_SOURCE_WIDTH,
- "display-src-width",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //59
- {
- MM_CAM_DISPLAY_SOURCE_HEIGHT,
- "display-src-height",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //60
- {
- MM_CAM_DISPLAY_ROTATION,
- "display-rotation",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_DISPLAY_ROTATION_NONE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_ROTATION_NONE,
- MM_DISPLAY_ROTATION_270,
- _mmcamcorder_commit_display_rotation,
- },
- //61
- {
- MM_CAM_DISPLAY_VISIBLE,
- "display-visible",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)1},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)visible_values,
- ARRAY_SIZE(visible_values),
- _mmcamcorder_commit_display_visible,
- },
- //62
- {
- MM_CAM_DISPLAY_SCALE,
- "display-scale",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_SCALE_DEFAULT,
- MM_DISPLAY_SCALE_TRIPLE_LENGTH,
- _mmcamcorder_commit_display_scale,
- },
- //63
- {
- MM_CAM_DISPLAY_GEOMETRY_METHOD,
- "display-geometry-method",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_METHOD_LETTER_BOX,
- MM_DISPLAY_METHOD_CUSTOM_ROI,
- _mmcamcorder_commit_display_geometry_method,
- },
- //64
- {
- MM_CAM_TARGET_FILENAME,
- "target-filename",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- {(void*)"/tmp/CAM-NONAME"},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- _mmcamcorder_commit_target_filename,
- },
- //65
- {
- MM_CAM_TARGET_MAX_SIZE,
- "target-max-size",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //66
- {
- MM_CAM_TARGET_TIME_LIMIT,
- "target-time-limit",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- NULL,
- },
- //67
- {
- MM_CAM_TAG_ENABLE,
- "tag-enable",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- NULL,
- },
- //68
- {
- MM_CAM_TAG_IMAGE_DESCRIPTION,
- "tag-image-description",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //69
- {
- MM_CAM_TAG_ORIENTATION,
- "tag-orientation",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)1},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- (int)tag_orientation_values,
- ARRAY_SIZE(tag_orientation_values),
- NULL,
- },
- //70
- {
- MM_CAM_TAG_SOFTWARE,
- "tag-software",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //71
- {
- MM_CAM_TAG_LATITUDE,
- "tag-latitude",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- -360,
- 360,
- NULL,
- },
- //72
- {
- MM_CAM_TAG_LONGITUDE,
- "tag-longitude",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- -360,
- 360,
- NULL,
- },
- //73
- {
- MM_CAM_TAG_ALTITUDE,
- "tag-altitude",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- -999999,
- 999999,
- NULL,
- },
- //74
- {
- MM_CAM_STROBE_CONTROL,
- "strobe-control",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_strobe,
- },
- //75
- {
- MM_CAM_STROBE_CAPABILITIES,
- "strobe-capabilities",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_strobe,
- },
- //76
- {
- MM_CAM_STROBE_MODE,
- "strobe-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_strobe,
- },
- //77
- {
- MM_CAM_DETECT_MODE,
- "detect-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_detect,
- },
- //78
- {
- MM_CAM_DETECT_NUMBER,
- "detect-number",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_detect,
- },
- //79
- {
- MM_CAM_DETECT_FOCUS_SELECT,
- "detect-focus-select",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_detect,
- },
- //80
- {
- MM_CAM_DETECT_SELECT_NUMBER,
- "detect-select-number",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- _mmcamcorder_commit_detect,
- },
- //81
- {
- MM_CAM_DETECT_STATUS,
- "detect-status",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_detect,
- },
- //82
- {
- MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
- "capture-zero-systemlag",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- NULL,
- },
- //83
- {
- MM_CAM_CAMERA_AF_TOUCH_X,
- "camera-af-touch-x",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_af_touch_area,
- },
- //84
- {
- MM_CAM_CAMERA_AF_TOUCH_Y,
- "camera-af-touch-y",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_af_touch_area,
- },
- //85
- {
- MM_CAM_CAMERA_AF_TOUCH_WIDTH,
- "camera-af-touch-width",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_af_touch_area,
- },
- //86
- {
- MM_CAM_CAMERA_AF_TOUCH_HEIGHT,
- "camera-af-touch-height",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_af_touch_area,
- },
- //87
- {
- MM_CAM_CAMERA_FOCAL_LENGTH,
- "camera-focal-length",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- 0,
- 1000,
- _mmcamcorder_commit_camera_capture_mode,
- },
- //88
- {
- MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
- "recommend-preview-format-for-capture",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_PIXEL_FORMAT_YUYV},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_PIXEL_FORMAT_NV12,
- MM_PIXEL_FORMAT_ITLV_JPEG_UYVY,
- NULL,
- },
- //89
- {
- MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
- "recommend-preview-format-for-recording",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_PIXEL_FORMAT_NV12},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_PIXEL_FORMAT_NV12,
- MM_PIXEL_FORMAT_ITLV_JPEG_UYVY,
- NULL,
- },
- //90
- {
- MM_CAM_CAPTURE_THUMBNAIL,
- "capture-thumbnail",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)TRUE},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //91
- {
- MM_CAM_TAG_GPS_ENABLE,
- "tag-gps-enable",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)TRUE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- NULL,
- },
- //92
- {
- MM_CAM_TAG_GPS_TIME_STAMP,
- "tag-gps-time-stamp",
- MMF_VALUE_TYPE_DOUBLE,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //93
- {
- MM_CAM_TAG_GPS_DATE_STAMP,
- "tag-gps-date-stamp",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //94
- {
- MM_CAM_TAG_GPS_PROCESSING_METHOD,
- "tag-gps-processing-method",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_RW,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //95
- {
- MM_CAM_CAMERA_ROTATION,
- "camera-rotation",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_VIDEO_INPUT_ROTATION_NONE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_VIDEO_INPUT_ROTATION_NONE,
- MM_VIDEO_INPUT_ROTATION_270,
- _mmcamcorder_commit_camera_rotate,
- },
- //96
- {
- MM_CAM_ENABLE_CONVERTED_STREAM_CALLBACK,
- "enable-converted-stream-callback",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- NULL,
- },
- //97
- {
- MM_CAM_CAPTURED_SCREENNAIL,
- "captured-screennail",
- MMF_VALUE_TYPE_DATA,
- MM_ATTRS_FLAG_READABLE,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //98
- {
- MM_CAM_CAPTURE_SOUND_ENABLE,
- "capture-sound-enable",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)TRUE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- 1,
- _mmcamcorder_commit_capture_sound_enable,
- },
- //99
- {
- MM_CAM_RECOMMEND_DISPLAY_ROTATION,
- "recommend-display-rotation",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_DISPLAY_ROTATION_270},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_DISPLAY_ROTATION_NONE,
- MM_DISPLAY_ROTATION_270,
- NULL,
- },
- //100
- {
- MM_CAM_CAMERA_FLIP,
- "camera-flip",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_FLIP_NONE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_FLIP_NONE,
- MM_FLIP_BOTH,
- _mmcamcorder_commit_camera_flip,
- },
- //101
- {
- MM_CAM_CAMERA_HDR_CAPTURE,
- "camera-hdr-capture",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_hdr_capture,
- },
- //102
- {
- MM_CAM_DISPLAY_MODE,
- "display-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_DISPLAY_MODE_DEFAULT},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_display_mode,
- },
- //103
- {
- MM_CAM_CAMERA_FACE_ZOOM_X,
- "camera-face-zoom-x",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_face_zoom,
- },
- //104
- {
- MM_CAM_CAMERA_FACE_ZOOM_Y,
- "camera-face-zoom-y",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- _MMCAMCORDER_MAX_INT,
- _mmcamcorder_commit_camera_face_zoom,
- },
- //105
- {
- MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
- "camera-face-zoom-level",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)0},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- 0,
- -1,
- NULL,
- },
- //106
- {
- MM_CAM_CAMERA_FACE_ZOOM_MODE,
- "camera-face-zoom-mode",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_face_zoom,
- },
- //107
- {
- MM_CAM_AUDIO_DISABLE,
- "audio-disable",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)FALSE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE,
- _mmcamcorder_commit_audio_disable,
- },
- //108
- {
- MM_CAM_RECOMMEND_CAMERA_WIDTH,
- "recommend-camera-width",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- NULL,
- },
- //109
- {
- MM_CAM_RECOMMEND_CAMERA_HEIGHT,
- "recommend-camera-height",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- NULL,
- },
- //110
- {
- MM_CAM_CAPTURED_EXIF_RAW_DATA,
- "captured-exif-raw-data",
- MMF_VALUE_TYPE_DATA,
- MM_ATTRS_FLAG_READABLE,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //111
- {
- MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
- "display-evas-surface-sink",
- MMF_VALUE_TYPE_STRING,
- MM_ATTRS_FLAG_READABLE,
- {(void*)NULL},
- MM_ATTRS_VALID_TYPE_NONE,
- 0,
- 0,
- NULL,
- },
- //112
- {
- MM_CAM_DISPLAY_EVAS_DO_SCALING,
- "display-evas-do-scaling",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)TRUE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- FALSE,
- TRUE,
- _mmcamcorder_commit_display_evas_do_scaling,
- },
- //113
- {
- MM_CAM_CAMERA_FACING_DIRECTION,
- "camera-facing-direction",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR,
- MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT,
- NULL,
- },
- //114
- {
- MM_CAM_DISPLAY_FLIP,
- "display-flip",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_FLIP_NONE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_FLIP_NONE,
- MM_FLIP_BOTH,
- _mmcamcorder_commit_display_flip,
- },
- //115
- {
- MM_CAM_CAMERA_VIDEO_STABILIZATION,
- "camera-video-stabilization",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_CAMCORDER_VIDEO_STABILIZATION_OFF},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- 0,
- 0,
- _mmcamcorder_commit_camera_video_stabilization,
- },
- //118
- {
- MM_CAM_TAG_VIDEO_ORIENTATION,
- "tag-video-orientation",
- MMF_VALUE_TYPE_INT,
- MM_ATTRS_FLAG_RW,
- {(void*)MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
- MM_CAMCORDER_TAG_VIDEO_ORT_NONE,
- MM_CAMCORDER_TAG_VIDEO_ORT_270,
- NULL,
- }
-};
-
/*-----------------------------------------------------------------------
| LOCAL VARIABLE DEFINITIONS for internal |
MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
MM_CAM_CAPTURED_SCREENNAIL,
MM_CAM_RECOMMEND_DISPLAY_ROTATION,
+ MM_CAM_SUPPORT_ZSL_CAPTURE,
+ MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
+ MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB
};
/*-----------------------------------------------------------------------
-----------------------------------------------------------------------*/
/* STATIC INTERNAL FUNCTION */
static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, int height);
-static bool __mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height);
static int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle);
static int __mmcamcorder_release_conf_valid_info(MMHandleType handle);
static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx);
{
_mmcam_dbg_log( "" );
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
MMHandleType attrs = 0;
mmf_attrs_construct_info_t *attrs_const_info = NULL;
- int attr_count = 0;
- int idx;
+ unsigned int attr_count = 0;
+ unsigned int idx;
+
+ static int depth[] = {MM_CAMCORDER_AUDIO_FORMAT_PCM_U8, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE};
+ static int flip_list[] = { MM_FLIP_NONE };
+ static int rotation_list[] = { MM_VIDEO_INPUT_ROTATION_NONE };
+ static int visible_values[] = { 0, 1 }; /*0: off, 1:on*/
+ static int tag_orientation_values[] =
+ {
+ 1, /*The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.*/
+ 2, /*the 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.*/
+ 3, /*the 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.*/
+ 4, /*the 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.*/
+ 5, /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual top.*/
+ 6, /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual top.*/
+ 7, /*the 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.*/
+ 8, /*the 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.*/
+ };
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return 0;
+ }
/* Create attribute constructor */
_mmcam_dbg_log("start");
/* alloc 'mmf_attrs_construct_info_t' */
- attr_count = ARRAY_SIZE(cam_attrs_const_info);
+ attr_count = MM_CAM_ATTRIBUTE_NUM;
attrs_const_info = malloc(attr_count * sizeof(mmf_attrs_construct_info_t));
-
if (!attrs_const_info) {
_mmcam_dbg_err("Fail to alloc constructor.");
return 0;
}
+ /* alloc default attribute info */
+ hcamcorder->cam_attrs_const_info = (mm_cam_attr_construct_info *)malloc(sizeof(mm_cam_attr_construct_info) * attr_count);
+ if (hcamcorder->cam_attrs_const_info == NULL) {
+ _mmcam_dbg_err("failed to alloc default attribute info");
+ free(attrs_const_info);
+ attrs_const_info = NULL;
+ return 0;
+ }
+
+ /* basic attributes' info */
+ mm_cam_attr_construct_info temp_info[] = {
+ //0
+ {
+ MM_CAM_MODE, /* ID */
+ "mode", /* Name */
+ MMF_VALUE_TYPE_INT, /* Type */
+ MM_ATTRS_FLAG_RW, /* Flag */
+ {(void*)MM_CAMCORDER_MODE_VIDEO_CAPTURE}, /* Default value */
+ MM_ATTRS_VALID_TYPE_INT_RANGE, /* Validity type */
+ {MM_CAMCORDER_MODE_VIDEO_CAPTURE}, /* Validity val1 (min, *array,...) */
+ {MM_CAMCORDER_MODE_AUDIO}, /* Validity val2 (max, count, ...) */
+ NULL, /* Runtime setting function of the attribute */
+ },
+ {
+ MM_CAM_AUDIO_DEVICE,
+ "audio-device",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_AUDIO_DEVICE_MIC},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {MM_AUDIO_DEVICE_NUM-1},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_DEVICE_COUNT,
+ "camera-device-count",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_VIDEO_DEVICE_NUM},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_VIDEO_DEVICE_NONE},
+ {MM_VIDEO_DEVICE_NUM},
+ NULL,
+ },
+ {
+ MM_CAM_AUDIO_ENCODER,
+ "audio-encoder",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_AUDIO_CODEC_AMR},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {NULL},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_VIDEO_ENCODER,
+ "video-encoder",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_VIDEO_CODEC_MPEG4},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {NULL},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_IMAGE_ENCODER,
+ "image-encoder",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_IMAGE_CODEC_JPEG},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {NULL},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_FILE_FORMAT,
+ "file-format",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_FILE_FORMAT_MP4},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {NULL},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_DEVICE_NAME,
+ "camera-device-name",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_AUDIO_SAMPLERATE,
+ "audio-samplerate",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)8000},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_AUDIO_FORMAT,
+ "audio-format",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {depth},
+ {ARRAY_SIZE(depth)},
+ NULL,
+ },
+ //10
+ {
+ MM_CAM_AUDIO_CHANNEL,
+ "audio-channel",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)2},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {1},
+ {2},
+ NULL,
+ },
+ {
+ MM_CAM_AUDIO_VOLUME,
+ "audio-volume",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {0},
+ {10.0},
+ _mmcamcorder_commit_audio_volume,
+ },
+ {
+ MM_CAM_AUDIO_INPUT_ROUTE,
+ "audio-input-route",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
+ {MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY},
+ _mmcamcorder_commit_audio_input_route,
+ },
+ {
+ MM_CAM_FILTER_SCENE_MODE,
+ "filter-scene-mode",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_filter_scene_mode,
+ },
+ {
+ MM_CAM_FILTER_BRIGHTNESS,
+ "filter-brightness",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_filter,
+ },
+ {
+ MM_CAM_FILTER_CONTRAST,
+ "filter-contrast",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_filter,
+ },
+ {
+ MM_CAM_FILTER_WB,
+ "filter-wb",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_filter,
+ },
+ {
+ MM_CAM_FILTER_COLOR_TONE,
+ "filter-color-tone",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_filter,
+ },
+ {
+ MM_CAM_FILTER_SATURATION,
+ "filter-saturation",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_filter,
+ },
+ {
+ MM_CAM_FILTER_HUE,
+ "filter-hue",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_filter,
+ },
+ //20
+ {
+ MM_CAM_FILTER_SHARPNESS,
+ "filter-sharpness",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_filter,
+ },
+ {
+ MM_CAM_CAMERA_FORMAT,
+ "camera-format",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_PIXEL_FORMAT_YUYV},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_RECORDING_MOTION_RATE,
+ "camera-recording-motion-rate",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_camera_recording_motion_rate,
+ },
+ {
+ MM_CAM_CAMERA_FPS,
+ "camera-fps",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)30},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_fps,
+ },
+ {
+ MM_CAM_CAMERA_WIDTH,
+ "camera-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_width,
+ },
+ {
+ MM_CAM_CAMERA_HEIGHT,
+ "camera-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_height,
+ },
+ {
+ MM_CAM_CAMERA_DIGITAL_ZOOM,
+ "camera-digital-zoom",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)10},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_camera_zoom,
+ },
+ {
+ MM_CAM_CAMERA_OPTICAL_ZOOM,
+ "camera-optical-zoom",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_camera_zoom,
+ },
+ {
+ MM_CAM_CAMERA_FOCUS_MODE,
+ "camera-focus-mode",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_CAMCORDER_FOCUS_MODE_NONE},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_focus_mode,
+ },
+ {
+ MM_CAM_CAMERA_AF_SCAN_RANGE,
+ "camera-af-scan-range",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_af_scan_range,
+ },
+ //30
+ {
+ MM_CAM_CAMERA_EXPOSURE_MODE,
+ "camera-exposure-mode",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_capture_mode,
+ },
+ {
+ MM_CAM_CAMERA_EXPOSURE_VALUE,
+ "camera-exposure-value",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_camera_capture_mode,
+ },
+ {
+ MM_CAM_CAMERA_F_NUMBER,
+ "camera-f-number",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_capture_mode,
+ },
+ {
+ MM_CAM_CAMERA_SHUTTER_SPEED,
+ "camera-shutter-speed",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_capture_mode,
+ },
+ {
+ MM_CAM_CAMERA_ISO,
+ "camera-iso",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_capture_mode,
+ },
+ {
+ MM_CAM_CAMERA_WDR,
+ "camera-wdr",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_wdr,
+ },
+ {
+ MM_CAM_CAMERA_ANTI_HANDSHAKE,
+ "camera-anti-handshake",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_anti_handshake,
+ },
+ {
+ MM_CAM_CAMERA_FPS_AUTO,
+ "camera-fps-auto",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_DELAY_ATTR_SETTING,
+ "camera-delay-attr-setting",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ NULL,
+ },
+ {
+ MM_CAM_AUDIO_ENCODER_BITRATE,
+ "audio-encoder-bitrate",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ // 40
+ {
+ MM_CAM_VIDEO_ENCODER_BITRATE,
+ "video-encoder-bitrate",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_IMAGE_ENCODER_QUALITY,
+ "image-encoder-quality",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)95},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_image_encoder_quality,
+ },
+ {
+ MM_CAM_CAPTURE_FORMAT,
+ "capture-format",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_PIXEL_FORMAT_ENCODED},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_CAPTURE_WIDTH,
+ "capture-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1600},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_capture_width ,
+ },
+ {
+ MM_CAM_CAPTURE_HEIGHT,
+ "capture-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1200},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_capture_height,
+ },
+ {
+ MM_CAM_CAPTURE_COUNT,
+ "capture-count",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_capture_count,
+ },
+ {
+ MM_CAM_CAPTURE_INTERVAL,
+ "capture-interval",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_CAPTURE_BREAK_CONTINUOUS_SHOT,
+ "capture-break-cont-shot",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ _mmcamcorder_commit_capture_break_cont_shot,
+ },
+ {
+ MM_CAM_DISPLAY_HANDLE,
+ "display-handle",
+ MMF_VALUE_TYPE_DATA,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ _mmcamcorder_commit_display_handle,
+ },
+ {
+ MM_CAM_DISPLAY_DEVICE,
+ "display-device",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_DISPLAY_DEVICE_MAINLCD},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ NULL,
+ },
+ // 50
+ {
+ MM_CAM_DISPLAY_SURFACE,
+ "display-surface",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_DISPLAY_SURFACE_X},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_RECT_X,
+ "display-rect-x",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_display_rect,
+ },
+ {
+ MM_CAM_DISPLAY_RECT_Y,
+ "display-rect-y",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_display_rect,
+ },
+ {
+ MM_CAM_DISPLAY_RECT_WIDTH,
+ "display-rect-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_display_rect,
+ },
+ {
+ MM_CAM_DISPLAY_RECT_HEIGHT,
+ "display-rect-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_display_rect,
+ },
+ {
+ MM_CAM_DISPLAY_SOURCE_X,
+ "display-src-x",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_SOURCE_Y,
+ "display-src-y",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_SOURCE_WIDTH,
+ "display-src-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_SOURCE_HEIGHT,
+ "display-src-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_ROTATION,
+ "display-rotation",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_DISPLAY_ROTATION_NONE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_DISPLAY_ROTATION_NONE},
+ {MM_DISPLAY_ROTATION_270},
+ _mmcamcorder_commit_display_rotation,
+ },
+ { // 60
+ MM_CAM_DISPLAY_VISIBLE,
+ "display-visible",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {visible_values},
+ {ARRAY_SIZE(visible_values)},
+ _mmcamcorder_commit_display_visible,
+ },
+ {
+ MM_CAM_DISPLAY_SCALE,
+ "display-scale",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_DISPLAY_SCALE_DEFAULT},
+ {MM_DISPLAY_SCALE_TRIPLE_LENGTH},
+ _mmcamcorder_commit_display_scale,
+ },
+ {
+ MM_CAM_DISPLAY_GEOMETRY_METHOD,
+ "display-geometry-method",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_DISPLAY_METHOD_LETTER_BOX},
+ {MM_DISPLAY_METHOD_CUSTOM_ROI},
+ _mmcamcorder_commit_display_geometry_method,
+ },
+ {
+ MM_CAM_TARGET_FILENAME,
+ "target-filename",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ _mmcamcorder_commit_target_filename,
+ },
+ {
+ MM_CAM_TARGET_MAX_SIZE,
+ "target-max-size",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_TARGET_TIME_LIMIT,
+ "target-time-limit",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_ENABLE,
+ "tag-enable",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_IMAGE_DESCRIPTION,
+ "tag-image-description",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_ORIENTATION,
+ "tag-orientation",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)1},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {tag_orientation_values},
+ {ARRAY_SIZE(tag_orientation_values)},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_SOFTWARE,
+ "tag-software",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ //70
+ {
+ MM_CAM_TAG_LATITUDE,
+ "tag-latitude",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {-360},
+ {360},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_LONGITUDE,
+ "tag-longitude",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {-360},
+ {360},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_ALTITUDE,
+ "tag-altitude",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {-999999},
+ {999999},
+ NULL,
+ },
+ {
+ MM_CAM_STROBE_CONTROL,
+ "strobe-control",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_strobe,
+ },
+ {
+ MM_CAM_STROBE_CAPABILITIES,
+ "strobe-capabilities",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_strobe,
+ },
+ {
+ MM_CAM_STROBE_MODE,
+ "strobe-mode",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_strobe,
+ },
+ {
+ MM_CAM_DETECT_MODE,
+ "detect-mode",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_detect,
+ },
+ {
+ MM_CAM_DETECT_NUMBER,
+ "detect-number",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_detect,
+ },
+ {
+ MM_CAM_DETECT_FOCUS_SELECT,
+ "detect-focus-select",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_detect,
+ },
+ {
+ MM_CAM_DETECT_SELECT_NUMBER,
+ "detect-select-number",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {-1},
+ _mmcamcorder_commit_detect,
+ },
+ //80
+ {
+ MM_CAM_DETECT_STATUS,
+ "detect-status",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_detect,
+ },
+ {
+ MM_CAM_CAPTURE_ZERO_SYSTEMLAG,
+ "capture-zero-systemlag",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_AF_TOUCH_X,
+ "camera-af-touch-x",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_camera_af_touch_area,
+ },
+ {
+ MM_CAM_CAMERA_AF_TOUCH_Y,
+ "camera-af-touch-y",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_camera_af_touch_area,
+ },
+ {
+ MM_CAM_CAMERA_AF_TOUCH_WIDTH,
+ "camera-af-touch-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_camera_af_touch_area,
+ },
+ {
+ MM_CAM_CAMERA_AF_TOUCH_HEIGHT,
+ "camera-af-touch-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {_MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_camera_af_touch_area,
+ },
+ {
+ MM_CAM_CAMERA_FOCAL_LENGTH,
+ "camera-focal-length",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {0},
+ {1000},
+ _mmcamcorder_commit_camera_capture_mode,
+ },
+ {
+ MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE,
+ "recommend-preview-format-for-capture",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_PIXEL_FORMAT_YUYV},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_PIXEL_FORMAT_NV12},
+ {(MM_PIXEL_FORMAT_NUM-1)},
+ NULL,
+ },
+ {
+ MM_CAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING,
+ "recommend-preview-format-for-recording",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_PIXEL_FORMAT_NV12},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_PIXEL_FORMAT_NV12},
+ {(MM_PIXEL_FORMAT_NUM-1)},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_GPS_ENABLE,
+ "tag-gps-enable",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ NULL,
+ },
+ // 90
+ {
+ MM_CAM_TAG_GPS_TIME_STAMP,
+ "tag-gps-time-stamp",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_GPS_DATE_STAMP,
+ "tag-gps-date-stamp",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_TAG_GPS_PROCESSING_METHOD,
+ "tag-gps-processing-method",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_ROTATION,
+ "camera-rotation",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_VIDEO_INPUT_ROTATION_NONE},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {rotation_list},
+ {ARRAY_SIZE(rotation_list)},
+ _mmcamcorder_commit_camera_rotate,
+ },
+ {
+ MM_CAM_CAPTURED_SCREENNAIL,
+ "captured-screennail",
+ MMF_VALUE_TYPE_DATA,
+ MM_ATTRS_FLAG_READABLE,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_CAPTURE_SOUND_ENABLE,
+ "capture-sound-enable",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)TRUE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {0},
+ {1},
+ _mmcamcorder_commit_capture_sound_enable,
+ },
+ {
+ MM_CAM_RECOMMEND_DISPLAY_ROTATION,
+ "recommend-display-rotation",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_DISPLAY_ROTATION_270},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_DISPLAY_ROTATION_NONE},
+ {MM_DISPLAY_ROTATION_270},
+ NULL,
+ },
+ {
+ MM_CAM_CAMERA_FLIP,
+ "camera-flip",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_FLIP_NONE},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {flip_list},
+ {ARRAY_SIZE(flip_list)},
+ _mmcamcorder_commit_camera_flip,
+ },
+ {
+ MM_CAM_CAMERA_HDR_CAPTURE,
+ "camera-hdr-capture",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_hdr_capture,
+ },
+ {
+ MM_CAM_DISPLAY_MODE,
+ "display-mode",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_DISPLAY_MODE_DEFAULT},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_display_mode,
+ },
+ //100
+ {
+ MM_CAM_AUDIO_DISABLE,
+ "audio-disable",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {FALSE},
+ {TRUE},
+ _mmcamcorder_commit_audio_disable,
+ },
+ {
+ MM_CAM_RECOMMEND_CAMERA_WIDTH,
+ "recommend-camera-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_RECOMMEND_CAMERA_HEIGHT,
+ "recommend-camera-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_CAPTURED_EXIF_RAW_DATA,
+ "captured-exif-raw-data",
+ MMF_VALUE_TYPE_DATA,
+ MM_ATTRS_FLAG_READABLE,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_EVAS_SURFACE_SINK,
+ "display-evas-surface-sink",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_READABLE,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_EVAS_DO_SCALING,
+ "display-evas-do-scaling",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)TRUE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {FALSE},
+ {TRUE},
+ _mmcamcorder_commit_display_evas_do_scaling,
+ },
+ {
+ MM_CAM_CAMERA_FACING_DIRECTION,
+ "camera-facing-direction",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
+ {MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_FLIP,
+ "display-flip",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_FLIP_NONE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_FLIP_NONE},
+ {MM_FLIP_BOTH},
+ _mmcamcorder_commit_display_flip,
+ },
+ {
+ MM_CAM_CAMERA_VIDEO_STABILIZATION,
+ "camera-video-stabilization",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_CAMCORDER_VIDEO_STABILIZATION_OFF},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_camera_video_stabilization,
+ },
+ {
+ MM_CAM_TAG_VIDEO_ORIENTATION,
+ "tag-video-orientation",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
+ {MM_CAMCORDER_TAG_VIDEO_ORT_270},
+ NULL,
+ },
+ //110
+ {
+ MM_CAM_VIDEO_WIDTH,
+ "video-width",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_video_size,
+ },
+ {
+ MM_CAM_VIDEO_HEIGHT,
+ "video-height",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {0},
+ {0},
+ _mmcamcorder_commit_video_size,
+ },
+ {
+ MM_CAM_SUPPORT_ZSL_CAPTURE,
+ "support-zsl-capture",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {FALSE},
+ {TRUE},
+ NULL,
+ },
+ {
+ MM_CAM_SUPPORT_ZERO_COPY_FORMAT,
+ "support-zero-copy-format",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {FALSE},
+ {TRUE},
+ NULL,
+ },
+ {
+ MM_CAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB,
+ "support-media-packet-preview-cb",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {FALSE},
+ {TRUE},
+ NULL,
+ }
+ };
+
+ memcpy(hcamcorder->cam_attrs_const_info, temp_info, sizeof(mm_cam_attr_construct_info) * attr_count);
+
for (idx = 0 ; idx < attr_count ; idx++) {
/* attribute order check. This should be same. */
- if (idx != cam_attrs_const_info[idx].attrid) {
+ if (idx != hcamcorder->cam_attrs_const_info[idx].attrid) {
_mmcam_dbg_err("Please check attributes order. Is the idx same with enum val?");
+ free(attrs_const_info);
+ attrs_const_info = NULL;
+ free(hcamcorder->cam_attrs_const_info);
+ hcamcorder->cam_attrs_const_info = NULL;
return 0;
}
- attrs_const_info[idx].name = cam_attrs_const_info[idx].name;
- attrs_const_info[idx].value_type = cam_attrs_const_info[idx].value_type;
- attrs_const_info[idx].flags = cam_attrs_const_info[idx].flags;
- attrs_const_info[idx].default_value = cam_attrs_const_info[idx].default_value.value_void;
+ attrs_const_info[idx].name = hcamcorder->cam_attrs_const_info[idx].name;
+ attrs_const_info[idx].value_type = hcamcorder->cam_attrs_const_info[idx].value_type;
+ attrs_const_info[idx].flags = hcamcorder->cam_attrs_const_info[idx].flags;
+ attrs_const_info[idx].default_value = hcamcorder->cam_attrs_const_info[idx].default_value.value_void;
}
/* Camcorder Attributes */
if (attrs == 0) {
_mmcam_dbg_err("Fail to alloc attribute handle");
+ free(hcamcorder->cam_attrs_const_info);
+ hcamcorder->cam_attrs_const_info = NULL;
return 0;
}
/* _mmcam_dbg_log("Valid type [%s:%d, %d, %d]", cam_attrs_const_info[idx].name, cam_attrs_const_info[idx].validity_type
, cam_attrs_const_info[idx].validity_value1, cam_attrs_const_info[idx].validity_value2);
*/
- mmf_attrs_set_valid_type (attrs, idx, cam_attrs_const_info[idx].validity_type);
+ mmf_attrs_set_valid_type (attrs, idx, hcamcorder->cam_attrs_const_info[idx].validity_type);
- switch (cam_attrs_const_info[idx].validity_type)
+ switch (hcamcorder->cam_attrs_const_info[idx].validity_type)
{
case MM_ATTRS_VALID_TYPE_INT_ARRAY:
- if (cam_attrs_const_info[idx].validity_value1 &&
- cam_attrs_const_info[idx].validity_value2 > 0) {
+ if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array &&
+ hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
mmf_attrs_set_valid_array(attrs, idx,
- (const int *)(cam_attrs_const_info[idx].validity_value1),
- cam_attrs_const_info[idx].validity_value2,
- (int)(cam_attrs_const_info[idx].default_value.value_int));
+ (const int *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array),
+ hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
+ hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
}
break;
case MM_ATTRS_VALID_TYPE_INT_RANGE:
mmf_attrs_set_valid_range(attrs, idx,
- cam_attrs_const_info[idx].validity_value1,
- cam_attrs_const_info[idx].validity_value2,
- (int)(cam_attrs_const_info[idx].default_value.value_int));
+ hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_min,
+ hcamcorder->cam_attrs_const_info[idx].validity_value_2.int_max,
+ hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
- if (cam_attrs_const_info[idx].validity_value1 &&
- cam_attrs_const_info[idx].validity_value2 > 0) {
+ if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array &&
+ hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
mmf_attrs_set_valid_double_array(attrs, idx,
- (const double *)(cam_attrs_const_info[idx].validity_value1),
- cam_attrs_const_info[idx].validity_value2,
- (double)(cam_attrs_const_info[idx].default_value.value_double));
+ (const double *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array),
+ hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
+ hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
}
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
mmf_attrs_set_valid_double_range(attrs, idx,
- (double)(cam_attrs_const_info[idx].validity_value1),
- (double)(cam_attrs_const_info[idx].validity_value2),
- (double)(cam_attrs_const_info[idx].default_value.value_double));
+ hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_min,
+ hcamcorder->cam_attrs_const_info[idx].validity_value_2.double_max,
+ hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
break;
case MM_ATTRS_VALID_TYPE_NONE:
break;
void
-_mmcamcorder_dealloc_attribute(MMHandleType attrs)
+_mmcamcorder_dealloc_attribute(MMHandleType handle, MMHandleType attrs)
{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return;
+ }
+
_mmcam_dbg_log("");
- if (attrs)
- {
+ if (attrs) {
mmf_attrs_free(attrs);
-
_mmcam_dbg_log("released attribute");
}
+
+ if (hcamcorder->cam_attrs_const_info) {
+ free(hcamcorder->cam_attrs_const_info);
+ hcamcorder->cam_attrs_const_info = NULL;
+ _mmcam_dbg_log("released attribute info");
+ }
}
-int
+int
_mmcamcorder_get_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args)
{
MMHandleType attrs = 0;
}
-int
+int
_mmcamcorder_set_attributes(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args)
{
MMHandleType attrs = 0;
mmf_return_val_if_fail( handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
// mmf_return_val_if_fail( err_attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
- attrs = MMF_CAMCORDER_ATTRS(handle);
- mmf_return_val_if_fail( attrs, MM_ERROR_CAMCORDER_NOT_INITIALIZED );
+ if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) {
+ _mmcam_dbg_err("Another command is running.");
+ return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+ }
- __ta__( "__mmcamcorder_check_valid_pair",
- ret = __mmcamcorder_check_valid_pair( handle, err_attr_name, attribute_name, var_args );
- );
+ attrs = MMF_CAMCORDER_ATTRS(handle);
+ if (attrs) {
+ ret = __mmcamcorder_check_valid_pair( handle, err_attr_name, attribute_name, var_args );
+ } else {
+ _mmcam_dbg_err("handle 0x%x, attrs is NULL, attr name [%s]", handle, attribute_name);
+ ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
+ }
if (ret == MM_ERROR_NONE) {
ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args);
}
+ _MMCAMCORDER_UNLOCK_CMD(handle);
+
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("failed error code 0x%x - handle %p", ret, (mmf_camcorder_t *)handle);
+ }
+
return ret;
}
-int
+int
_mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCamAttrsInfo *info)
{
MMHandleType attrs = 0;
}
-//attribute commiter
-void
-__mmcamcorder_print_attrs (const char *attr_name, const mmf_value_t *value, char* cmt_way)
-{
- switch(value->type)
- {
- case MMF_VALUE_TYPE_INT:
- _mmcam_dbg_log("%s :(%s:%d)", cmt_way, attr_name, value->value.i_val);
- break;
- case MMF_VALUE_TYPE_DOUBLE:
- _mmcam_dbg_log("%s :(%s:%f)", cmt_way, attr_name, value->value.d_val);
- break;
- case MMF_VALUE_TYPE_STRING:
- _mmcam_dbg_log("%s :(%s:%s)", cmt_way, attr_name, value->value.s_val);
- break;
- case MMF_VALUE_TYPE_DATA:
- _mmcam_dbg_log("%s :(%s:%p)", cmt_way, attr_name, value->value.p_val);
- break;
- }
-
- return;
-}
-
bool
_mmcamcorder_commit_camcorder_attrs (int attr_idx, const char *attr_name, const mmf_value_t *value, void *commit_param)
{
bool bret = FALSE;
+ mmf_camcorder_t *hcamcorder = NULL;
mmf_return_val_if_fail(commit_param, FALSE);
mmf_return_val_if_fail(attr_idx >= 0, FALSE);
mmf_return_val_if_fail(attr_name, FALSE);
mmf_return_val_if_fail(value, FALSE);
- if (cam_attrs_const_info[attr_idx].attr_commit)
- {
-// _mmcam_dbg_log("Dynamic commit:(%s)", attr_name);
- __mmcamcorder_print_attrs(attr_name, value, "Dynamic");
- bret = cam_attrs_const_info[attr_idx].attr_commit((MMHandleType)commit_param, attr_idx, value);
- }
- else
- {
-// _mmcam_dbg_log("Static commit:(%s)", attr_name);
- __mmcamcorder_print_attrs(attr_name, value, "Static");
+ hcamcorder = MMF_CAMCORDER(commit_param);
+
+ if (hcamcorder->cam_attrs_const_info[attr_idx].attr_commit) {
+ bret = hcamcorder->cam_attrs_const_info[attr_idx].attr_commit((MMHandleType)commit_param, attr_idx, value);
+ } else {
bret = TRUE;
}
int *format = NULL;
int total_count = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ }
+
/* Audio encoder */
total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER, &format);
- cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1 = (int)format;
- cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value2 = (int)total_count;
+ hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array = format;
+ hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_2.count = total_count;
/* Video encoder */
total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER, &format);
- cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1 = (int)format;
- cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value2 = (int)total_count;
+ hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array = format;
+ hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_2.count = total_count;
/* Image encoder */
total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER, &format);
- cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1 = (int)format;
- cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value2 = (int)total_count;
+ hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array = format;
+ hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_2.count = total_count;
/* File format */
total_count = _mmcamcorder_get_available_format(handle, CONFIGURE_CATEGORY_MAIN_MUX, &format);
- cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1 = (int)format;
- cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value2 = (int)total_count;
+ hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array = format;
+ hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = total_count;
return MM_ERROR_NONE;
}
{
int *allocated_memory = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ }
+
_mmcam_dbg_log("START");
/* Audio encoder info */
- allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1);
+ allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array);
if (allocated_memory) {
free(allocated_memory);
- cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1 = (int)NULL;
- cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value2 = (int)0;
+ hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_1.int_array = NULL;
+ hcamcorder->cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value_2.count = 0;
}
/* Video encoder info */
- allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1);
+ allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array);
if (allocated_memory) {
free(allocated_memory);
- cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1 = (int)NULL;
- cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value2 = (int)0;
+ hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_1.int_array = NULL;
+ hcamcorder->cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value_2.count = 0;
}
/* Image encoder info */
- allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1);
+ allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array);
if (allocated_memory) {
free(allocated_memory);
- cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1 = (int)NULL;
- cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value2 = (int)0;
+ hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_1.int_array = NULL;
+ hcamcorder->cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value_2.count = 0;
}
/* File format info */
- allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1);
+ allocated_memory = (int *)(hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array);
if (allocated_memory) {
free(allocated_memory);
- cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1 = (int)NULL;
- cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value2 = (int)0;
+ hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_1.int_array = NULL;
+ hcamcorder->cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value_2.count = 0;
}
_mmcam_dbg_log("DONE");
GstCameraControl *control = NULL;
type_element *VideosrcElement = NULL;
- char* videosrc_name = NULL;
+ const char *videosrc_name = NULL;
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"VideosrcElement",
&VideosrcElement );
if (!sc)
return TRUE;
- if( ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING )
- {
- if( !strcmp( videosrc_name, "avsysvideosrc" ) || !strcmp( videosrc_name, "camerasrc" ) )
- {
- if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
- {
- _mmcam_dbg_err("Can't cast Video source into camera control.");
- return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
- }
-
- control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
+ if (ivalue && current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ _mmcam_dbg_warn("Can't cast Video source into camera control.");
+ return TRUE;
+ }
- gst_camera_control_set_capture_command( control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT );
+ control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
+ gst_camera_control_set_capture_command( control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT );
- _mmcam_dbg_warn( "Commit Break continuous shot : Set command OK. current state[%d]", current_state );
- }
- else
- {
- _mmcam_dbg_warn( "Another videosrc plugin[%s] is not supported yet.", videosrc_name );
- }
- }
- else
- {
+ _mmcam_dbg_warn( "Commit Break continuous shot : Set command OK. current state[%d]", current_state );
+ } else {
_mmcam_dbg_warn( "Commit Break continuous shot : No effect. value[%d],current state[%d]", ivalue, current_state );
}
bool bret = FALSE;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- if (!sc)
+ if (!sc) {
return TRUE;
+ }
current_state = _mmcamcorder_get_state( handle);
- if ((current_state == MM_CAMCORDER_STATE_RECORDING)||(current_state == MM_CAMCORDER_STATE_PAUSED))
- {
+ if ((current_state == MM_CAMCORDER_STATE_RECORDING)||(current_state == MM_CAMCORDER_STATE_PAUSED)) {
double mslNewVal = 0;
mslNewVal = value->value.d_val;
- if (sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst)
- {
- if(mslNewVal == 0.0)
- {
- //Because data probe of audio src do the same job, it doesn't need to set mute here. Already null raw data.
-// MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", TRUE);
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
- }
- else
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", mslNewVal);
+ if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst) {
+ if (mslNewVal == 0.0) {
+ /* Because data probe of audio src do the same job, it doesn't need to set mute here. Already null raw data. */
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
+ } else {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", mslNewVal);
}
}
_mmcam_dbg_log("Commit : volume(%f)", mslNewVal);
bret = TRUE;
- }
- else
- {
+ } else {
_mmcam_dbg_log("Commit : nothing to commit. status(%d)", current_state);
bret = TRUE;
}
int current_state = MM_CAMCORDER_STATE_NONE;
_MMCamcorderSubContext *sc = NULL;
- mmf_return_val_if_fail(handle, TRUE);
+ mmf_return_val_if_fail(handle, FALSE);
current_state = _mmcamcorder_get_state(handle);
/* Verify recording motion rate */
if (value->value.d_val > 0.0) {
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
+ if (!sc) {
+ return TRUE;
+ }
/* set is_slow flag */
if (value->value.d_val != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
}
-bool _mmcamcorder_commit_camera_width (MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
MMHandleType attr = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
- int width, height;
+ int ret = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, FALSE);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc) {
+ return TRUE;
+ }
attr = MMF_CAMCORDER_ATTRS(handle);
mmf_return_val_if_fail(attr, FALSE);
current_state = _mmcamcorder_get_state(handle);
- if (current_state > MM_CAMCORDER_STATE_READY) {
+ if (current_state > MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state);
return FALSE;
} else {
flags = info.flag;
if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
- mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_HEIGHT, &height, NULL);
- width = value->value.i_val;
- //This means that width is changed while height isn't changed. So call _mmcamcorder_commit_camera_height forcely.
- _mmcam_dbg_log("Call _mmcamcorder_commit_camera_height");
- return __mmcamcorder_set_camera_resolution(handle, width, height);
+ int width = value->value.i_val;
+ int height = 0;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+ int codec_type = MM_IMAGE_CODEC_JPEG;
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_HEIGHT, &height,
+ MMCAM_CAMERA_FORMAT, &preview_format,
+ MMCAM_IMAGE_ENCODER, &codec_type,
+ NULL);
+
+ if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+ if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) {
+ _mmcam_dbg_log("restart preview");
+
+ 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);
+
+ _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+ /* get preview format */
+ sc->info_image->preview_format = preview_format;
+ sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+ ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+ _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+
+ /* unlock */
+ pthread_mutex_unlock(&(hcamcorder->restart_preview_lock));
+ } else {
+ _mmcam_dbg_err("currently locked for preview restart");
+ return FALSE;
+ }
+ } else {
+ /* get preview format */
+ sc->info_image->preview_format = preview_format;
+ sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+ ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+ }
+
+ return ret;
}
+
return TRUE;
}
}
-bool _mmcamcorder_commit_camera_height (MMHandleType handle, int attr_idx, const mmf_value_t *value)
+bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
- int width, height;
+ int ret = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
MMHandleType attr = 0;
-
- attr = MMF_CAMCORDER_ATTRS(handle);
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, FALSE);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc) {
+ return TRUE;
+ }
+
+ attr = MMF_CAMCORDER_ATTRS(hcamcorder);
mmf_return_val_if_fail(attr, FALSE);
_mmcam_dbg_log("Height(%d)", value->value.i_val);
current_state = _mmcamcorder_get_state( handle);
- if (current_state > MM_CAMCORDER_STATE_READY) {
+ if (current_state > MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state);
return FALSE;
} else {
- height = value->value.i_val;
- mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_WIDTH, &width, NULL);
- return __mmcamcorder_set_camera_resolution(handle, width, height);
+ int width = 0;
+ int height = value->value.i_val;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+ int codec_type = MM_IMAGE_CODEC_JPEG;
+ int video_stabilization = 0;
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_WIDTH, &width,
+ MMCAM_CAMERA_FORMAT, &preview_format,
+ MMCAM_IMAGE_ENCODER, &codec_type,
+ MMCAM_CAMERA_VIDEO_STABILIZATION, &video_stabilization,
+ NULL);
+
+ sc->info_video->preview_width = width;
+ sc->info_video->preview_height = height;
+
+ if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+ if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) {
+ _mmcam_dbg_log("restart preview");
+
+ _mmcam_dbg_log("set empty buffers");
+
+ 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);
+
+ _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+ /* get preview format */
+ sc->info_image->preview_format = preview_format;
+ sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+
+ ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+ _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+
+ /* unlock */
+ pthread_mutex_unlock(&(hcamcorder->restart_preview_lock));
+ } else {
+ _mmcam_dbg_err("currently locked for preview restart");
+ return FALSE;
+ }
+ } else {
+ /* get preview format */
+ sc->info_image->preview_format = preview_format;
+ sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format);
+ ret = _mmcamcorder_set_camera_resolution(handle, width, height);
+ }
+
+ return ret;
+ }
+}
+
+
+bool _mmcamcorder_commit_video_size(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ int current_state = MM_CAMCORDER_STATE_NONE;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ mmf_return_val_if_fail(hcamcorder, FALSE);
+
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state > MM_CAMCORDER_STATE_PREPARE) {
+ _mmcam_dbg_err("Video Resolution can't be changed.(state=%d)", current_state);
+ return FALSE;
+ } else {
+ _mmcam_dbg_warn("Video Resolution %d [attr_idx %d] ",
+ value->value.i_val, attr_idx);
+ return TRUE;
}
}
int zoom_type;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
+ if (!sc) {
+ return TRUE;
+ }
_mmcam_dbg_log("(%d)", attr_idx);
current_state = _mmcamcorder_get_state(handle);
-
- if (current_state < MM_CAMCORDER_STATE_PREPARE) {
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("will be applied when preview starts");
return TRUE;
+ } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_warn("Can not set while CAPTURING");
+ return FALSE;
}
if (attr_idx == MM_CAM_CAMERA_OPTICAL_ZOOM) {
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_log("Can't cast Video source into camera control.");
- return TRUE;
+ return TRUE;
}
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
-
- __ta__(" gst_camera_control_set_zoom",
ret = gst_camera_control_set_zoom(control, zoom_type, zoom_level);
- );
-
if (ret) {
_mmcam_dbg_log("Succeed in operating Zoom[%d].", zoom_level);
return TRUE;
_MMCamcorderSubContext *sc = NULL;
GstCameraControl *control = NULL;
int mslVal;
- int mode, cur_focus_mode, cur_focus_range;
+ int set_focus_mode = 0;
+ int cur_focus_mode = 0;
+ int cur_focus_range = 0;
attr = MMF_CAMCORDER_ATTRS(handle);
mmf_return_val_if_fail(attr, FALSE);
return TRUE;
}
- if( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst )
- {
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
int flags = MM_ATTRS_FLAG_NONE;
MMCamAttrsInfo info;
- if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
- {
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_log("Can't cast Video source into camera control.");
return TRUE;
}
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
mslVal = value->value.i_val;
- mode = _mmcamcorder_convert_msl_to_sensor( handle, attr_idx, mslVal );
+ set_focus_mode = _mmcamcorder_convert_msl_to_sensor( handle, attr_idx, mslVal );
mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_SCAN_RANGE, &info);
flags = info.flag;
- if (!(flags & MM_ATTRS_FLAG_MODIFIED))
- {
- if( gst_camera_control_get_focus( control, &cur_focus_mode, &cur_focus_range ) )
- {
- if( mode != cur_focus_mode )
- {
- MMTA_ACUM_ITEM_BEGIN(" gst_camera_control_set_focus", 0);
- if( gst_camera_control_set_focus( control, mode, cur_focus_range ) )
- {
- MMTA_ACUM_ITEM_END(" gst_camera_control_set_focus", 0);
- _mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
- return TRUE;
- }
- else
- {
- _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
- }
- MMTA_ACUM_ITEM_END(" gst_camera_control_set_focus", 0);
- }
- else
- {
- _mmcam_dbg_log( "No need to set AF mode. Current[%d]", mslVal );
+ if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
+ if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) {
+ if (gst_camera_control_set_focus(control, set_focus_mode, cur_focus_range)) {
+ _mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal);
return TRUE;
+ } else {
+ _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal);
}
- }
- else
- {
- _mmcam_dbg_warn( "Failed to get AF mode, so do not set new AF mode[%d]", mslVal );
+ } else {
+ _mmcam_dbg_err("failed to get focus mode");
+ return FALSE;
}
}
- }
- else
- {
+ } else {
_mmcam_dbg_log("pointer of video src is null");
}
+
return TRUE;
}
_MMCamcorderSubContext *sc = NULL;
GstCameraControl *control = NULL;
int current_state = MM_CAMCORDER_STATE_NONE;
- int mslVal, newVal;
- int cur_focus_mode = 0;
- int cur_focus_range = 0;
+ int mslVal = 0;
+ int newVal = 0;
int msl_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
int converted_mode = 0;
newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
current_state = _mmcamcorder_get_state(handle);
- if (current_state < MM_CAMCORDER_STATE_PREPARE) {
- _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("af scan range will be changed later.(state=%d)", current_state);
return TRUE;
}
-
- if( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst )
- {
- if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
- {
+
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_log("Can't cast Video source into camera control.");
return TRUE;
}
mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &msl_mode, NULL);
converted_mode = _mmcamcorder_convert_msl_to_sensor( handle, MM_CAM_CAMERA_FOCUS_MODE, msl_mode );
- if( gst_camera_control_get_focus( control, &cur_focus_mode, &cur_focus_range ) )
- {
-
- if (( newVal != cur_focus_range ) || ( converted_mode != cur_focus_mode ))
- {
- MMTA_ACUM_ITEM_BEGIN(" gst_camera_control_set_focus", 0);
- if( gst_camera_control_set_focus( control, converted_mode, newVal ) )
- {
- MMTA_ACUM_ITEM_END(" gst_camera_control_set_focus", 0);
- //_mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
- return TRUE;
- }
- else
- {
- MMTA_ACUM_ITEM_END(" gst_camera_control_set_focus", 0);
- _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
- }
- }
- else
- {
- //_mmcam_dbg_log( "No need to set AF mode. Current[%d]", mslVal );
- return TRUE;
- }
- }
- else
- {
- _mmcam_dbg_warn( "Failed to get AF mode, so do not set new AF mode[%d]", mslVal );
+ if (gst_camera_control_set_focus(control, converted_mode, newVal)) {
+ //_mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
+ return TRUE;
+ } else {
+ _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
}
- }
- else
- {
+ } else {
_mmcam_dbg_log("pointer of video src is null");
}
return FALSE;
int current_state = MM_CAMCORDER_STATE_NONE;
int ret = FALSE;
int focus_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
-
+
gboolean do_set = FALSE;
-
+
MMCamAttrsInfo info_y, info_w, info_h;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
return TRUE;
}
-
+
ret = mm_camcorder_get_attributes(handle, NULL,
MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
NULL);
_mmcam_dbg_warn( "Failed to get FOCUS MODE.[%x]", ret );
return FALSE;
}
-
+
if ((focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO ) && (focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS))
{
_mmcam_dbg_warn( "Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode );
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
{
_mmcam_dbg_log("Can't cast Video source into camera control.");
- return TRUE;
+ return TRUE;
}
switch( attr_idx )
default:
break;
}
-
+
if( do_set )
{
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
-
- __ta__( " gst_camera_control_get_focus_area",
+
ret = gst_camera_control_get_auto_focus_area( control, &get_area );
- );
if( !ret )
{
_mmcam_dbg_warn( "Failed to get AF area" );
return FALSE;
}
-
+
if( get_area.x == set_area.x && get_area.y == set_area.y )
// width and height are not supported now.
// get_area.width == set_area.width && get_area.height == set_area.height
return TRUE;
}
- __ta__( " gst_camera_control_set_focus_area",
ret = gst_camera_control_set_auto_focus_area( control, set_area );
- );
if( ret )
{
_mmcam_dbg_log( "Succeed to set AF area[%d,%d,%dx%d]", set_area.x, set_area.y, set_area.width, set_area.height );
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
- __ta__(" gst_camera_control_set_exposure",
ret = gst_camera_control_set_exposure(control, exposure_type, newVal1, newVal2);
- );
if (ret) {
_mmcam_dbg_log("Succeed in setting exposure. Type[%d],value1[%d],value2[%d]", exposure_type, mslVal1, mslVal2 );
return TRUE;
}
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
+ if (!sc) {
+ return TRUE;
+ }
/* check current state */
current_state = _mmcamcorder_get_state( handle);
- if (current_state < MM_CAMCORDER_STATE_PREPARE) {
- _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("will be applied when preview starts");
return TRUE;
- }
-
- if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
- _mmcam_dbg_warn("Can not set WDR while CAPTURING");
+ } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_warn("Can not set while CAPTURING");
return FALSE;
}
}
-bool _mmcamcorder_commit_camera_hold_af_after_capturing (MMHandleType handle, int attr_idx, const mmf_value_t *value)
-{
- _MMCamcorderSubContext *sc = NULL;
- int current_state = MM_CAMCORDER_STATE_NONE;
-
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- if (!sc)
- return TRUE;
-
- current_state = _mmcamcorder_get_state(handle);
-
- if( current_state < MM_CAMCORDER_STATE_READY )
- {
- _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
- return TRUE;
- }
-
- if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)
- {
- _mmcam_dbg_log("Commit : value of Hold af after capturing is %d", value->value.i_val);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", value->value.i_val);
- }
- else
- _mmcam_dbg_warn("Commit : Hold af after capturing cannot be set");
-
- return TRUE;
-}
-
-
bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
int current_state = MM_CAMCORDER_STATE_NONE;
bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
_MMCamcorderSubContext *sc = NULL;
- char * filename = NULL;
+ const char * filename = NULL;
int size = 0;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- if (!sc)
+ if (!sc) {
return TRUE;
+ }
/* get string */
- filename = (char *)mmf_value_get_string(value, &size);
+ filename = mmf_value_get_string(value, &size);
+
+ if (sc->info_video) {
+ if (sc->info_video->filename) {
+ free(sc->info_video->filename);
+ sc->info_video->filename = NULL;
+ }
+ sc->info_video->filename = strdup(filename);
+ if (sc->info_video->filename == NULL) {
+ _mmcam_dbg_err("failed to strdup filename [%s]", filename);
+ return FALSE;
+ }
+ }
- if (sc->element && sc->element[_MMCAMCORDER_ENCSINK_SINK].gst) {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
+ if (sc->encode_element && sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst) {
+ _mmcam_dbg_log("new file location set.[%s] filesink %p", filename, sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
_mmcam_dbg_log("new file location set.(%s)", filename);
} else {
_mmcam_dbg_log("element is not created yet. [%s] will be set later...", filename);
int newVal = 0;
int mslNewVal = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
- gchar * control_label = NULL;
+ const char *control_label = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
gboolean check_scene_mode = FALSE;
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_log("handle is NULL");
+ return FALSE;
+ }
+
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
if (!sc)
return TRUE;
}
current_state = _mmcamcorder_get_state(handle);
- if (current_state < MM_CAMCORDER_STATE_PREPARE) {
- _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("will be applied when preview starts");
return TRUE;
+ } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_warn("Can not set while CAPTURING");
+ return FALSE;
}
if (value->type != MM_ATTRS_TYPE_INT) {
control_label = "sharpness";
check_scene_mode = TRUE;
break;
+ default:
+ _mmcam_dbg_err("unknown attribute index %d", attr_idx);
+ return FALSE;
}
if (check_scene_mode) {
}
newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslNewVal);
- if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE)
+ if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE) {
return FALSE;
-
+ }
+
_mmcam_dbg_log("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);
-
+
if (!GST_IS_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_log("Can't cast Video source into color balance.");
return TRUE;
}
-
- balance = GST_COLOR_BALANCE (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
- controls = gst_color_balance_list_channels (balance);
+ balance = GST_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ controls = gst_color_balance_list_channels(balance);
if (controls == NULL) {
_mmcam_dbg_log("There is no list of colorbalance controls");
return FALSE;
}
- for (item = controls ; item != NULL ; item = item->next) {
- if (item) {
- if (item->data) {
- Colorchannel = item->data;
- /*_mmcam_dbg_log("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);*/
+ for (item = controls ; item && item->data ; item = item->next) {
+ Colorchannel = item->data;
+ //_mmcam_dbg_log("Getting name of CID=(%s), input CID=(%s)", Colorchannel->label, control_label);
- if (!strcmp(Colorchannel->label, control_label)) {
- break;
- } else {
- Colorchannel = NULL;
- }
- }
+ if (!strcmp(Colorchannel->label, control_label)) {
+ gst_color_balance_set_value (balance, Colorchannel, newVal);
+ _mmcam_dbg_log("Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal);
+ break;
}
}
- if (Colorchannel== NULL) {
- _mmcam_dbg_log("There is no data in the colorbalance controls(%d)", attr_idx);
+ if (item == NULL) {
+ _mmcam_dbg_err("failed to find color channel item");
return FALSE;
}
- __ta__(" gst_color_balance_set_value",
- gst_color_balance_set_value (balance, Colorchannel, newVal);
- );
-
- _mmcam_dbg_log( "Set complete - %s[msl:%d,real:%d]", Colorchannel->label, mslNewVal, newVal);
-
return TRUE;
}
}
current_state = _mmcamcorder_get_state(handle);
- if (current_state < MM_CAMCORDER_STATE_PREPARE) {
+ if (current_state < MM_CAMCORDER_STATE_READY) {
_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
return TRUE;
}
-
+
if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
int ret = 0;
return TRUE;
}
- control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
- __ta__(" gst_camera_control_set_exposure:GST_CAMERA_CONTROL_PROGRAM_MODE",
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
ret = gst_camera_control_set_exposure(control, GST_CAMERA_CONTROL_PROGRAM_MODE, newVal, 0);
- );
if (ret) {
_mmcam_dbg_log("Succeed in setting program mode[%d].", mslVal);
if (mslVal == MM_CAMCORDER_SCENE_MODE_NORMAL) {
- int i = 0;
+ unsigned int i = 0;
int attr_idxs[] = {
MM_CAM_CAMERA_ISO
, MM_CAM_FILTER_BRIGHTNESS
}
-bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value)
-{
- int ret = 0;
- int current_state = MM_CAMCORDER_STATE_NONE;
-
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- GstCameraControl *control = NULL;
- _MMCamcorderSubContext *sc = NULL;
-
- mmf_return_val_if_fail(hcamcorder, FALSE);
-
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
-
- /* these are only available after camera preview is started */
- current_state = _mmcamcorder_get_state(handle);
- if (current_state >= MM_CAMCORDER_STATE_PREPARE &&
- hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
- int x = 0;
- int y = 0;
- int zoom_level = 0;
- int preview_width = 0;
- int preview_height = 0;
-
- switch (attr_idx) {
- case MM_CAM_CAMERA_FACE_ZOOM_X:
- /* check x coordinate of face zoom */
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_WIDTH, &preview_width,
- NULL);
- /* x coordinate should be smaller than width of preview */
- if (value->value.i_val < preview_width) {
- _mmcam_dbg_log("set face zoom x %d done", value->value.i_val);
- ret = TRUE;
- } else {
- _mmcam_dbg_err("invalid face zoom x %d", value->value.i_val);
- ret = FALSE;
- }
- break;
- case MM_CAM_CAMERA_FACE_ZOOM_Y:
- /* check y coordinate of face zoom */
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_WIDTH, &preview_height,
- NULL);
- /* y coordinate should be smaller than height of preview */
- if (value->value.i_val < preview_height) {
- _mmcam_dbg_log("set face zoom y %d done", value->value.i_val);
- ret = TRUE;
- } else {
- _mmcam_dbg_err("invalid face zoom y %d", value->value.i_val);
- ret = FALSE;
- }
- break;
- case MM_CAM_CAMERA_FACE_ZOOM_MODE:
- if (value->value.i_val == MM_CAMCORDER_FACE_ZOOM_MODE_ON) {
- int face_detect_mode = MM_CAMCORDER_DETECT_MODE_OFF;
-
- /* start face zoom */
- /* get x,y coordinate and zoom level */
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_FACE_ZOOM_X, &x,
- MMCAM_CAMERA_FACE_ZOOM_Y, &y,
- MMCAM_CAMERA_FACE_ZOOM_LEVEL, &zoom_level,
- MMCAM_DETECT_MODE, &face_detect_mode,
- NULL);
-
- if (face_detect_mode == MM_CAMCORDER_DETECT_MODE_ON) {
- control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
- __ta__(" gst_camera_control_start_face_zoom",
- ret = gst_camera_control_start_face_zoom(control, x, y, zoom_level);
- );
- } else {
- _mmcam_dbg_err("face detect is OFF... could not start face zoom");
- ret = FALSE;
- }
- } else if (value->value.i_val == MM_CAMCORDER_FACE_ZOOM_MODE_OFF) {
- /* stop face zoom */
- control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
- __ta__(" gst_camera_control_stop_face_zoom",
- ret = gst_camera_control_stop_face_zoom(control);
- );
- } else {
- /* should not be reached here */
- _mmcam_dbg_err("unknown command [%d]", value->value.i_val);
- ret = FALSE;
- }
-
- if (!ret) {
- _mmcam_dbg_err("face zoom[%d] failed", value->value.i_val);
- ret = FALSE;
- } else {
- _mmcam_dbg_log("");
- ret = TRUE;
- }
- break;
- default:
- _mmcam_dbg_warn("should not be reached here. attr_idx %d", attr_idx);
- break;
- }
- } else {
- _mmcam_dbg_err("invalid state[%d] or mode[%d]", current_state, hcamcorder->type);
- ret = FALSE;
- }
-
- return ret;
-}
-
-
bool _mmcamcorder_commit_audio_input_route (MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
_mmcam_dbg_log("Commit : Do nothing. this attr will be removed soon.");
bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
int current_state = MM_CAMCORDER_STATE_NONE;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
void *p_handle = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
_mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) {
+ if (!strcmp(videosink_name, "xvimagesink") ||
+ !strcmp(videosink_name, "ximagesink")) {
_mmcam_dbg_log("Commit : Set XID[%x]", *(int*)(p_handle));
- gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(p_handle));
+ gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(p_handle));
} else if (!strcmp(videosink_name, "evasimagesink") ||
- !strcmp(videosink_name, "evaspixmapsink")) {
+ !strcmp(videosink_name, "evaspixmapsink")) {
_mmcam_dbg_log("Commit : Set evas object [%p]", p_handle);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
} else {
bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
int current_state = MM_CAMCORDER_STATE_NONE;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
/* check current state */
current_state = _mmcamcorder_get_state(handle);
if (current_state < MM_CAMCORDER_STATE_READY) {
- _mmcam_dbg_log("NOT initialized. this will be applied later");
+ _mmcam_dbg_log("NOT initialized. this will be applied later [rotate:%d]", value->value.i_val);
return TRUE;
}
/* check current state */
current_state = _mmcamcorder_get_state(handle);
if (current_state < MM_CAMCORDER_STATE_READY) {
- _mmcam_dbg_log("NOT initialized. this will be applied later");
+ _mmcam_dbg_log("NOT initialized. this will be applied later [flip:%d]", value->value.i_val);
return TRUE;
}
bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
int current_state = MM_CAMCORDER_STATE_NONE;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
{
int method = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
{
int current_state = MM_CAMCORDER_STATE_NONE;
int method = 0;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
{
int zoom = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
GstElement *vs_element = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
if (!strcmp(videosink_name, "xvimagesink")) {
vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
- MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", zoom + 1);
+ MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1));
_mmcam_dbg_log("Set display zoom to %d", zoom + 1);
return TRUE;
{
int current_state = MM_CAMCORDER_STATE_NONE;
int do_scaling = 0;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER( handle);
_MMCamcorderSubContext *sc = NULL;
//status check
current_state = _mmcamcorder_get_state( handle);
-
- if (current_state < MM_CAMCORDER_STATE_PREPARE ||
- current_state == MM_CAMCORDER_STATE_CAPTURING) {
- //_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
return TRUE;
+ } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
+ _mmcam_dbg_warn("invalid state[capturing]");
+ return FALSE;
}
mslVal = value->value.i_val;
bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
+ int set_hdr_mode = MM_CAMCORDER_HDR_OFF;
int current_state = MM_CAMCORDER_STATE_NONE;
+ _MMCamcorderSubContext *sc = NULL;
if ((void *)handle == NULL) {
_mmcam_dbg_warn("handle is NULL");
return FALSE;
}
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ int current_value = 0;
+
+ set_hdr_mode = value->value.i_val;
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_HDR_CAPTURE, ¤t_value,
+ NULL);
+
+ if (set_hdr_mode == current_value) {
+ _mmcam_dbg_log("same HDR value : %d, do nothing", set_hdr_mode);
+ return TRUE;
+ }
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (sc) {
+ if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+ 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);
+
+ _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ }
+
+ set_hdr_mode = value->value.i_val;
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", set_hdr_mode);
+ sc->info_image->hdr_capture_mode = set_hdr_mode;
+ _mmcam_dbg_log("set HDR mode : %d", set_hdr_mode);
+
+ if (current_state == MM_CAMCORDER_STATE_PREPARE) {
+ _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+ }
+ } else {
+ _mmcam_dbg_err("sc is NULL. can not set HDR capture");
+ return FALSE;
+ }
+ }
+
return TRUE;
}
/* state check */
current_state = _mmcamcorder_get_state( handle);
if (current_state < MM_CAMCORDER_STATE_READY) {
- //_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
+ _mmcam_dbg_log("will be applied when preview starts");
return TRUE;
}
int scene_mode = MM_CAMCORDER_SCENE_MODE_NORMAL;
- int i = 0 ;
+ unsigned int i = 0 ;
int ret = TRUE;
int attr_idxs_default[] = {
MM_CAM_CAMERA_DIGITAL_ZOOM
, MM_CAM_CAMERA_OPTICAL_ZOOM
, MM_CAM_CAMERA_WDR
- , MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING
, MM_CAM_FILTER_CONTRAST
, MM_CAM_FILTER_HUE
, MM_CAM_STROBE_MODE
_mmcam_dbg_log("Set all attribute again.");
- MMTA_ACUM_ITEM_BEGIN(" _mmcamcorder_set_attribute_to_camsensor", 0);
-
attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
if (attr == NULL) {
_mmcam_dbg_err("Get attribute handle failed.");
}
}
- MMTA_ACUM_ITEM_END(" _mmcamcorder_set_attribute_to_camsensor", 0);
-
_mmcam_dbg_log("Done.");
return ret;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
attr = (mmf_attrs_t*) MMF_CAMCORDER_ATTRS(handle);
- mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
_mmcam_dbg_log("");
for (i = 0; i < table_size; i++)
{
int sCategory = readonly_attributes[i];
-
+
mmf_attribute_set_readonly(&(attr->items[sCategory]));
}
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
attr = (mmf_attrs_t*) MMF_CAMCORDER_ATTRS(handle);
- mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ mmf_return_val_if_fail(attr, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
_mmcam_dbg_log("");
mmf_return_val_if_fail(hcamcorder, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
+ if (!sc) {
+ return TRUE;
+ }
current_state = _mmcamcorder_get_state(handle);
}
-static bool __mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height)
-{
- int fps = 0;
- double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
-
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderSubContext *sc = NULL;
- GstCaps *caps = NULL;
-
- mmf_return_val_if_fail(hcamcorder, FALSE);
-
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
-
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_FPS, &fps,
- MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
- NULL);
-
- if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
- if(motion_rate != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
- } else {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0);
- }
- }
-
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, sc->format_name,
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- NULL);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
- gst_caps_unref(caps);
-
- return TRUE;
-}
-
static int
__mmcamcorder_check_valid_pair( MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args )
{
#define INIT_VALUE -1
- #define CHECK_COUNT 2
- #define CAMERA_RESOLUTION 0
- #define CAPTURE_RESOLUTION 1
+ #define CHECK_COUNT 3
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
MMHandleType attrs = 0;
int ret = MM_ERROR_NONE;
int i = 0, j = 0;
- char *name = NULL;
- char *check_pair_name[2][3] = {
- { MMCAM_CAMERA_WIDTH, MMCAM_CAMERA_HEIGHT, "MMCAM_CAMERA_WIDTH and HEIGHT" },
- { MMCAM_CAPTURE_WIDTH, MMCAM_CAPTURE_HEIGHT, "MMCAM_CAPTURE_WIDTH and HEIGHT" },
+ const char *name = NULL;
+ const char *check_pair_name[CHECK_COUNT][3] = {
+ {MMCAM_CAMERA_WIDTH, MMCAM_CAMERA_HEIGHT, "MMCAM_CAMERA_WIDTH and HEIGHT"},
+ {MMCAM_CAPTURE_WIDTH, MMCAM_CAPTURE_HEIGHT, "MMCAM_CAPTURE_WIDTH and HEIGHT"},
+ {MMCAM_VIDEO_WIDTH, MMCAM_VIDEO_HEIGHT, "MMCAM_VIDEO_WIDTH and HEIGHT"},
};
- int check_pair_value[2][2] = {
- { INIT_VALUE, INIT_VALUE },
- { INIT_VALUE, INIT_VALUE },
+ int check_pair_value[CHECK_COUNT][2] = {
+ {INIT_VALUE, INIT_VALUE},
+ {INIT_VALUE, INIT_VALUE},
+ {INIT_VALUE, INIT_VALUE},
};
- if( hcamcorder == NULL || attribute_name == NULL )
- {
- _mmcam_dbg_warn( "handle[%p] or attribute_name[%p] is NULL.",
- hcamcorder, attribute_name );
+ if (hcamcorder == NULL || attribute_name == NULL) {
+ _mmcam_dbg_warn("handle[%p] or attribute_name[%p] is NULL.",
+ hcamcorder, attribute_name );
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
- if( err_attr_name )
+ if (err_attr_name) {
*err_attr_name = NULL;
+ }
//_mmcam_dbg_log( "ENTER" );
attrs = MMF_CAMCORDER_ATTRS(handle);
- name = (char*)attribute_name;
+ name = attribute_name;
- while( name )
- {
+ while (name) {
int idx = -1;
MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID;
- /*_mmcam_dbg_log( "NAME : %s", name );*/
+ /*_mmcam_dbg_log("NAME : %s", name);*/
/* attribute name check */
- if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE)
- {
- if (err_attr_name)
+ if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) {
+ if (err_attr_name) {
*err_attr_name = strdup(name);
+ }
- if (ret == MM_ERROR_COMMON_OUT_OF_ARRAY) //to avoid confusing
+ if (ret == (int)MM_ERROR_COMMON_OUT_OF_ARRAY) { //to avoid confusing
return MM_ERROR_COMMON_ATTR_NOT_EXIST;
- else
+ } else {
return ret;
+ }
}
/* type check */
- if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE)
+ if ((ret = mm_attrs_get_type(attrs, idx, &attr_type)) != MM_ERROR_NONE) {
return ret;
+ }
- switch (attr_type)
+ switch (attr_type) {
+ case MM_ATTRS_TYPE_INT:
{
- case MM_ATTRS_TYPE_INT:
- {
- gboolean matched = FALSE;
- for( i = 0 ; i < CHECK_COUNT ; i++ ) {
- for( j = 0 ; j < 2 ; j++ ) {
- if( !strcmp( name, check_pair_name[i][j] ) )
- {
- check_pair_value[i][j] = va_arg( (var_args), int );
- _mmcam_dbg_log( "%s : %d", check_pair_name[i][j], check_pair_value[i][j] );
- matched = TRUE;
- break;
- }
- }
- if( matched )
+ gboolean matched = FALSE;
+ for (i = 0 ; i < CHECK_COUNT ; i++) {
+ for (j = 0 ; j < 2 ; j++) {
+ if (!strcmp(name, check_pair_name[i][j])) {
+ check_pair_value[i][j] = va_arg((var_args), int);
+ _mmcam_dbg_log("%s : %d", check_pair_name[i][j], check_pair_value[i][j]);
+ matched = TRUE;
break;
+ }
+ }
+ if (matched) {
+ break;
}
- if( matched == FALSE )
- {
- va_arg ((var_args), int);
- }
- break;
}
- case MM_ATTRS_TYPE_DOUBLE:
- va_arg ((var_args), double);
- break;
- case MM_ATTRS_TYPE_STRING:
- va_arg ((var_args), char*); /* string */
- va_arg ((var_args), int); /* size */
- break;
- case MM_ATTRS_TYPE_DATA:
- va_arg ((var_args), void*); /* data */
- va_arg ((var_args), int); /* size */
- break;
- case MM_ATTRS_TYPE_INVALID:
- default:
- _mmcam_dbg_err( "Not supported attribute type(%d, name:%s)", attr_type, name);
- if (err_attr_name)
- *err_attr_name = strdup(name);
- return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ if (matched == FALSE) {
+ va_arg((var_args), int);
+ }
+ break;
+ }
+ case MM_ATTRS_TYPE_DOUBLE:
+ va_arg((var_args), double);
+ break;
+ case MM_ATTRS_TYPE_STRING:
+ va_arg((var_args), char*); /* string */
+ va_arg((var_args), int); /* size */
+ break;
+ case MM_ATTRS_TYPE_DATA:
+ va_arg((var_args), void*); /* data */
+ va_arg((var_args), int); /* size */
+ break;
+ case MM_ATTRS_TYPE_INVALID:
+ default:
+ _mmcam_dbg_err("Not supported attribute type(%d, name:%s)", attr_type, name);
+ if (err_attr_name) {
+ *err_attr_name = strdup(name);
+ }
+ return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
/* next name */
- name = va_arg (var_args, char*);
+ name = va_arg(var_args, const char*);
}
-
- for( i = 0 ; i < CHECK_COUNT ; i++ )
- {
- if( check_pair_value[i][0] != INIT_VALUE || check_pair_value[i][1] != INIT_VALUE )
- {
+
+ for (i = 0 ; i < CHECK_COUNT ; i++) {
+ if (check_pair_value[i][0] != INIT_VALUE || check_pair_value[i][1] != INIT_VALUE) {
gboolean check_result = FALSE;
char *err_name = NULL;
MMCamAttrsInfo attr_info_0, attr_info_1;
- if( check_pair_value[i][0] == INIT_VALUE )
- {
- mm_attrs_get_int_by_name( attrs, check_pair_name[i][0], &check_pair_value[i][0] );
+ if (check_pair_value[i][0] == INIT_VALUE) {
+ mm_attrs_get_int_by_name(attrs, check_pair_name[i][0], &check_pair_value[i][0]);
err_name = strdup(check_pair_name[i][1]);
- }
- else if( check_pair_value[i][1] == INIT_VALUE )
- {
- mm_attrs_get_int_by_name( attrs, check_pair_name[i][1], &check_pair_value[i][1] );
+ } else if (check_pair_value[i][1] == INIT_VALUE) {
+ mm_attrs_get_int_by_name(attrs, check_pair_name[i][1], &check_pair_value[i][1]);
err_name = strdup(check_pair_name[i][0]);
- }
- else
- {
+ } else {
err_name = strdup(check_pair_name[i][2]);
}
check_result = FALSE;
for( j = 0 ; j < attr_info_0.int_array.count ; j++ ) {
- if( attr_info_0.int_array.array[j] == check_pair_value[i][0]
- && attr_info_1.int_array.array[j] == check_pair_value[i][1] )
- {
- _mmcam_dbg_log( "Valid Pair[%s,%s] existed %dx%d[index:%d]",
- check_pair_name[i][0], check_pair_name[i][1],
- check_pair_value[i][0], check_pair_value[i][1], i );
+ if (attr_info_0.int_array.array[j] == check_pair_value[i][0] &&
+ attr_info_1.int_array.array[j] == check_pair_value[i][1]) {
+ /*
+ _mmcam_dbg_log("Valid Pair[%s,%s] existed %dx%d[index:%d]",
+ check_pair_name[i][0], check_pair_name[i][1],
+ check_pair_value[i][0], check_pair_value[i][1], i);
+ */
check_result = TRUE;
break;
}
}
- if( check_result == FALSE )
- {
- _mmcam_dbg_err( "INVALID pair[%s,%s] %dx%d",
- check_pair_name[i][0], check_pair_name[i][1],
- check_pair_value[i][0], check_pair_value[i][1] );
- if (err_attr_name)
+ if (check_result == FALSE) {
+ _mmcam_dbg_err("INVALID pair[%s,%s] %dx%d",
+ check_pair_name[i][0], check_pair_name[i][1],
+ check_pair_value[i][0], check_pair_value[i][1]);
+ if (err_attr_name) {
*err_attr_name = err_name;
+ } else {
+ if (err_name) {
+ free(err_name);
+ err_name = NULL;
+ }
+ }
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
=======================================================================================*/
#include "mm_camcorder_internal.h"
#include "mm_camcorder_audiorec.h"
+#include "mm_camcorder_util.h"
#include <math.h>
/*---------------------------------------------------------------------------------------
#define _MMCAMCORDER_AUDIO_MARGIN_SPACE (1*1024)
#define _MMCAMCORDER_RETRIAL_COUNT 10
#define _MMCAMCORDER_FRAME_WAIT_TIME 20000 /* micro second */
-#define _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL 5
+#define _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL 10
+
/*---------------------------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
---------------------------------------------------------------------------------------*/
static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle)
{
int err = MM_ERROR_NONE;
- char *aenc_name = NULL;
- char *mux_name = NULL;
+ const char *aenc_name = NULL;
+ const char *mux_name = NULL;
GstBus *bus = NULL;
GstPad *srcpad = NULL;
mmf_return_val_if_fail(sc->info_audio, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
info = (_MMCamcorderAudioInfo *)sc->info_audio;
-
+
_mmcam_dbg_log("");
mux_elem = _mmcamcorder_get_type_element(handle, MM_CAM_FILE_FORMAT);
err = _mmcamcorder_conf_get_value_element_name( mux_elem, &mux_name );
- if (!mux_name || !strcmp( mux_name, "wavenc" ) ) /* IF MUX in not chosen then record in raw amr file */
- {
- //But shoud we support non-mux recording??
+ if (!mux_name || !strcmp(mux_name, "wavenc")) {
+ /* IF MUX in not chosen then record in raw file */
_mmcam_dbg_log("Record without muxing.");
info->bMuxing = FALSE;
- }
- else
- {
+ } else {
_mmcam_dbg_log("Record with mux.");
info->bMuxing = TRUE;
}
- //Create gstreamer element
- //Main pipeline
- __ta__(" camcorder_pipeline",
- _MMCAMCORDER_PIPELINE_MAKE(sc, _MMCAMCORDER_MAIN_PIPE, "camcorder_pipeline", err);
- );
+ /* Create GStreamer pipeline */
+ _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "camcorder_pipeline", err);
- __ta__(" __mmcamcorder_create_audiosrc_bin",
err = _mmcamcorder_create_audiosrc_bin(handle);
- );
if (err != MM_ERROR_NONE) {
return err;
}
if (info->bMuxing) {
/* Muxing. can use encodebin. */
- __ta__(" _mmcamcorder_create_encodesink_bin",
err = _mmcamcorder_create_encodesink_bin((MMHandleType)hcamcorder, MM_CAMCORDER_ENCBIN_PROFILE_AUDIO);
- );
- if (err != MM_ERROR_NONE ) {
+ if (err != MM_ERROR_NONE) {
return err;
}
} else {
/* without muxing. can't use encodebin. */
aenc_elem = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER);
- if (!aenc_elem)
- {
+ if (!aenc_elem) {
_mmcam_dbg_err("Fail to get type element");
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
goto pipeline_creation_error;
}
err = _mmcamcorder_conf_get_value_element_name(aenc_elem, &aenc_name);
-
- if ((!err) || (!aenc_name))
- {
+ if ((!err) || (!aenc_name)) {
_mmcam_dbg_err("Fail to get element name");
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
goto pipeline_creation_error;
}
- __ta__(" audiopipeline_audioqueue",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_AQUE, "queue", NULL, element_list, err);
- );
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_AQUE, "queue", NULL, element_list, err);
- if( strcmp( aenc_name, "wavenc" ) != 0 )
- {
- __ta__(" audiopipeline_audioconvertor",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_CONV, "audioconvert", NULL, element_list, err);
- );
+ if (strcmp(aenc_name, "wavenc") != 0) {
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_CONV, "audioconvert", NULL, element_list, err);
}
- __ta__(" audiopipeline_audioencoder",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_AENC, aenc_name, NULL, element_list, err);
- );
-
- __ta__(" audiopipeline_filesink",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_SINK, "filesink", NULL, element_list, err);
- );
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_AENC, aenc_name, NULL, element_list, err);
- /* audio encoder attribute setting */
- if(strcmp(aenc_name,"ari_amrnbenc") == 0) //ari_armnbenc supports attatching amr header
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "write-header", TRUE);
- }
-
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, "filesink", NULL, element_list, err);
}
- //Set basic infomation
-
- if (info->bMuxing) /* IF MUX is indicated create MUX */
- {
- gst_bin_add_many(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst,
- NULL);
-
- srcpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
- sinkpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
+ /* Add and link elements */
+ if (info->bMuxing) {
+ /* IF MUX is indicated create MUX */
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst,
+ NULL);
+
+ srcpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
+ sinkpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
_MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
- }
- else /* IF MUX in not chosen then record in raw amr file */
- {
- if( !strcmp( aenc_name, "wavenc" ) )
- {
- gst_bin_add_many( GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL );
-
- if (!_MM_GST_ELEMENT_LINK_MANY( sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL ))
- {
+ } else {
+ /* IF MUX in not chosen then record in raw amr file */
+ if (!strcmp(aenc_name, "wavenc")) {
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+ NULL);
+
+ if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+ NULL)) {
err = MM_ERROR_CAMCORDER_GST_LINK;
goto pipeline_creation_error;
}
- }
- else
- {
- gst_bin_add_many( GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->element[_MMCAMCORDER_ENCSINK_CONV].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL );
-
- if (!_MM_GST_ELEMENT_LINK_MANY( sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->element[_MMCAMCORDER_ENCSINK_CONV].gst,
- sc->element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL ))
- {
+ } else {
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_CONV].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+ NULL);
+
+ if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_CONV].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
+ NULL)) {
err = MM_ERROR_CAMCORDER_GST_LINK;
goto pipeline_creation_error;
}
}
- }
-
+ }
- //set data probe function
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
+ /* set data probe function */
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_AUDIOREC,
- __mmcamcorder_audio_dataprobe_voicerecorder, hcamcorder);
+ __mmcamcorder_audio_dataprobe_voicerecorder, hcamcorder);
gst_object_unref(srcpad);
srcpad = NULL;
- if(info->bMuxing)
- {
- MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst,
- _MMCAMCORDER_HANDLER_AUDIOREC,
- "pad-added",
- __mmcamcorder_audiorec_pad_added_cb,
- hcamcorder);
- }
- else
- {
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
+ if (info->bMuxing) {
+ MMCAMCORDER_SIGNAL_CONNECT(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst,
+ _MMCAMCORDER_HANDLER_AUDIOREC,
+ "pad-added",
+ __mmcamcorder_audiorec_pad_added_cb,
+ hcamcorder);
+ } else {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_AUDIOREC,
- __mmcamcorder_audio_dataprobe_record, hcamcorder);
+ __mmcamcorder_audio_dataprobe_record, hcamcorder);
gst_object_unref(srcpad);
- srcpad = NULL;
+ srcpad = NULL;
}
- /*
- * To get the message callback from the gstreamer.
- * This can be used to make the API calls asynchronous
- * as per LiMO compliancy
- */
- bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
- hcamcorder->pipeline_cb_event_id = gst_bus_add_watch( bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder );
- gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, hcamcorder, NULL);
+ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
+
+ /* register message callback */
+ hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder);
+
+ /* set sync callback */
+ gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, hcamcorder, NULL);
+
gst_object_unref(bus);
+ bus = NULL;
+
+ if (element_list) {
+ g_list_free(element_list);
+ element_list = NULL;
+ }
return MM_ERROR_NONE;
pipeline_creation_error:
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_AQUE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_CONV);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_AENC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_SINK);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_BIN);
+
+ if (element_list) {
+ g_list_free(element_list);
+ element_list = NULL;
+ }
+
return err;
}
{
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
-
+
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_if_fail(sc->element);
info = sc->info_audio;
-
- _mmcam_dbg_log("");
- if(sc->element[_MMCAMCORDER_MAIN_PIPE].gst)
- {
- _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_NULL);
+ _mmcam_dbg_log("start");
+
+ if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
+ _mmcam_dbg_warn("release audio pipeline");
+
+ _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
_mmcamcorder_remove_all_handlers((MMHandleType)hcamcorder, _MMCAMCORDER_HANDLER_CATEGORY_ALL);
-
- if( info->bMuxing)
- {
+
+ if (info->bMuxing) {
GstPad *reqpad = NULL;
- //release request pad
- /* FIXME */
- /*
- The ref_count of mux is always # of streams in here, i don't know why it happens.
- So, i unref the mux manually
- */
- reqpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
- gst_object_unref(reqpad);
-
- if(GST_IS_ELEMENT(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst) && \
- GST_OBJECT_REFCOUNT_VALUE(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst) > 1)
- gst_object_unref(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst);
+ /* FIXME:
+ Release request pad
+ The ref_count of mux is always # of streams in here, i don't know why it happens.
+ So, i unref the mux manually
+ */
+ reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+ gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+ gst_object_unref(reqpad);
+
+ if(GST_IS_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst) &&
+ GST_OBJECT_REFCOUNT(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst) > 1) {
+ gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst);
+ }
}
- gst_object_unref(sc->element[_MMCAMCORDER_MAIN_PIPE].gst);
-// sc->element[_MMCAMCORDER_MAIN_PIPE].gst = NULL;
+ gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
}
+ _mmcam_dbg_log("done");
+
+ return;
}
void* _MMCamcorderStopHelperFunc(void *handle)
{
- mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
+ mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_mmcamcorder_set_state((MMHandleType)hcamcorder, hcamcorder->target_state);
return NULL;
_mmcam_dbg_log("");
- pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
- audioSrc = sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst;
- switch(cmd)
- {
- case _MMCamcorder_CMD_RECORD:
- //check status for resume case
- if (_mmcamcorder_get_state((MMHandleType)hcamcorder) != MM_CAMCORDER_STATE_PAUSED)
- {
- guint imax_size = 0;
- guint imax_time = 0;
- char *temp_filename = NULL;
-
- if(sc->pipeline_time) {
- gst_element_set_start_time(GST_ELEMENT(pipeline), sc->pipeline_time);
- }
- sc->pipeline_time = RESET_PAUSE_TIME;
-
- ret = mm_camcorder_get_attributes(handle, &err_attr_name,
- MMCAM_TARGET_MAX_SIZE, &imax_size,
- MMCAM_TARGET_TIME_LIMIT, &imax_time,
- MMCAM_FILE_FORMAT, &(info->fileformat),
- MMCAM_TARGET_FILENAME, &temp_filename, &size,
- NULL);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret);
- SAFE_FREE (err_attr_name);
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
- }
+ pipeline = sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst;
+ audioSrc = sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst;
+ switch (cmd) {
+ case _MMCamcorder_CMD_RECORD:
+ /* check status for resume case */
+ if (_mmcamcorder_get_state((MMHandleType)hcamcorder) != MM_CAMCORDER_STATE_PAUSED) {
+ guint imax_size = 0;
+ guint imax_time = 0;
+ char *temp_filename = NULL;
+ int file_system_type = 0;
+
+ if(sc->pipeline_time) {
+ gst_element_set_start_time(pipeline, sc->pipeline_time);
+ }
+ sc->pipeline_time = RESET_PAUSE_TIME;
+
+ ret = mm_camcorder_get_attributes(handle, &err_attr_name,
+ MMCAM_TARGET_MAX_SIZE, &imax_size,
+ MMCAM_TARGET_TIME_LIMIT, &imax_time,
+ MMCAM_FILE_FORMAT, &(info->fileformat),
+ MMCAM_TARGET_FILENAME, &temp_filename, &size,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret);
+ SAFE_FREE(err_attr_name);
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ }
- info->filename = strdup(temp_filename);
- if (!info->filename)
- {
- _mmcam_dbg_err("STRDUP was failed");
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
- }
-
- _mmcam_dbg_log("Record start : set file name using attribute - %s\n ",info->filename);
+ if (temp_filename == NULL) {
+ _mmcam_dbg_err("filename is not set");
+ ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ }
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
+ info->filename = strdup(temp_filename);
+ if (!info->filename) {
+ _mmcam_dbg_err("STRDUP was failed");
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ }
- sc->ferror_send = FALSE;
- sc->ferror_count = 0;
- sc->bget_eos = FALSE;
- info->filesize =0;
+ _mmcam_dbg_log("Record start : set file name using attribute - %s\n ",info->filename);
- /* set max size */
- if (imax_size <= 0) {
- info->max_size = 0; /* do not check */
- } else {
- info->max_size = ((guint64)imax_size) << 10; /* to byte */
- }
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
- /* set max time */
- if (imax_time <= 0) {
- info->max_time = 0; /* do not check */
- } else {
- info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
- }
+ sc->ferror_send = FALSE;
+ sc->ferror_count = 0;
+ sc->bget_eos = FALSE;
+ info->filesize =0;
- dir_name = g_path_get_dirname(info->filename);
- if (dir_name) {
- err = _mmcamcorder_get_freespace(dir_name, &free_space);
+ /* set max size */
+ if (imax_size <= 0) {
+ info->max_size = 0; /* do not check */
+ } else {
+ info->max_size = ((guint64)imax_size) << 10; /* to byte */
+ }
- _mmcam_dbg_warn("current space for recording - %s : [%" G_GUINT64_FORMAT "]",
- dir_name, free_space);
+ /* set max time */
+ if (imax_time <= 0) {
+ info->max_time = 0; /* do not check */
+ } else {
+ info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
+ }
- g_free(dir_name);
- dir_name = NULL;
+ /* TODO : check free space before recording start */
+ dir_name = g_path_get_dirname(info->filename);
+ if (dir_name) {
+ err = _mmcamcorder_get_freespace(dir_name, &free_space);
+ _mmcam_dbg_warn("current space for recording - %s :[%" G_GUINT64_FORMAT "]" ,dir_name, free_space);
+
+ if (_mmcamcorder_get_file_system_type(dir_name, &file_system_type) == 0) {
+ /* MSDOS_SUPER_MAGIC : 0x4d44 */
+ if (file_system_type == MSDOS_SUPER_MAGIC &&
+ (info->max_size == 0 || info->max_size > FAT32_FILE_SYSTEM_MAX_SIZE)) {
+ _mmcam_dbg_warn("FAT32 and too large max[%"G_GUINT64_FORMAT"], set max as %"G_GUINT64_FORMAT,
+ info->max_size, FAT32_FILE_SYSTEM_MAX_SIZE);
+ info->max_size = FAT32_FILE_SYSTEM_MAX_SIZE;
+ } else {
+ _mmcam_dbg_warn("file system 0x%x, max size %"G_GUINT64_FORMAT,
+ file_system_type, info->max_size);
+ }
} else {
- _mmcam_dbg_err("failed to get directory name");
- err = -1;
+ _mmcam_dbg_warn("_mmcamcorder_get_file_system_type failed");
}
- if ((err == -1) || free_space <= (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024))) {
- _mmcam_dbg_err("OUT of STORAGE [err:%d or free space [%" G_GUINT64_FORMAT "] is smaller than [%d]",
- err, free_space, (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024)));
- return MM_ERROR_OUT_OF_STORAGE;
- }
+ g_free(dir_name);
+ dir_name = NULL;
+ } else {
+ _mmcam_dbg_err("failed to get directory name");
+ err = -1;
}
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- if(ret<0) {
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ if ((err == -1) || free_space <= (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024))) {
+ _mmcam_dbg_err("OUT of STORAGE [err:%d or free space [%" G_GUINT64_FORMAT "] is smaller than [%d]",
+ err, free_space, (_MMCAMCORDER_AUDIO_MINIMUM_SPACE+(5*1024)));
+ return MM_ERROR_OUT_OF_STORAGE;
}
- break;
+ }
- case _MMCamcorder_CMD_PAUSE:
- {
- GstClock *clock = NULL;
- int count = 0;
-
- if (info->b_commiting)
- {
- _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
- return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
- }
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ }
+ break;
- for(count=0; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++)
- {
- if(info->filesize > 0)
- {
- break;
- }
- else if(count == _MMCAMCORDER_RETRIAL_COUNT)
- {
- _mmcam_dbg_err("Pause fail, we are waiting for 100 milisecond, but still file size is %" G_GUINT64_FORMAT "",
- info->filesize);
- return MM_ERROR_CAMCORDER_INVALID_CONDITION;
- }
- else
- {
- _mmcam_dbg_warn("Pause is Waiting for enough audio frame, retrial count[%d], file size is %" G_GUINT64_FORMAT "",
- count, info->filesize);
- }
- usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
- }
+ case _MMCamcorder_CMD_PAUSE:
+ {
+ GstClock *pipe_clock = NULL;
+ int count = 0;
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
- if(ret<0) {
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
- }
- //fixed me. consider delay.
- clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
- sc->pipeline_time = gst_clock_get_time(clock) - gst_element_get_base_time(GST_ELEMENT(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
- }
- break;
+ if (info->b_commiting) {
+ _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+ return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+ }
- case _MMCamcorder_CMD_CANCEL:
- if (info->b_commiting)
- {
- _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
- return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
- }
-
-// ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
- if(ret<0) {
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) {
+ if (info->filesize > 0) {
+ break;
+ } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
+ _mmcam_dbg_err("Pause fail, wait 200 ms, but file size is %lld",
+ info->filesize);
+ return MM_ERROR_CAMCORDER_INVALID_CONDITION;
+ } else {
+ _mmcam_dbg_warn("Wait for enough audio frame, retry count[%d], file size is %lld",
+ count, info->filesize);
}
+ usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
+ }
- if(info->bMuxing)
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
- }
- else
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
- }
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ }
- _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
-
- sc->pipeline_time = 0;
- sc->pause_time = 0;
- sc->isMaxsizePausing = FALSE;
- sc->isMaxtimePausing = FALSE;
-
- if(info->filename)
- {
- _mmcam_dbg_log("file delete(%s)", info->filename);
- unlink(info->filename);
- g_free(info->filename);
- info->filename = NULL;
- }
+ /* FIXME: consider delay. */
+ pipe_clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
+ sc->pipeline_time = gst_clock_get_time(pipe_clock) - gst_element_get_base_time(GST_ELEMENT(pipeline));
+ break;
+ }
- break;
- case _MMCamcorder_CMD_COMMIT:
- {
- int count = 0;
- g_print("\n\n _MMCamcorder_CMD_COMMIT\n\n");
+ case _MMCamcorder_CMD_CANCEL:
+ if (info->b_commiting) {
+ _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+ return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+ }
- if (info->b_commiting)
- {
- _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
- return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
- }
- else
- {
- _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
- info->b_commiting = TRUE;
- }
-
- for(count=0; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++)
- {
- if(info->filesize > 0)
- {
- break;
- }
- else if(count == _MMCAMCORDER_RETRIAL_COUNT)
- {
- _mmcam_dbg_err("Commit fail, we are waiting for 100 milisecond, but still file size is %" G_GUINT64_FORMAT "",
- info->filesize);
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
+ }
+
+ if (info->bMuxing) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ } else {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
+ }
+
+ _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
+
+ sc->pipeline_time = 0;
+ sc->pause_time = 0;
+ sc->isMaxsizePausing = FALSE;
+ sc->isMaxtimePausing = FALSE;
+
+ if (info->filename) {
+ _mmcam_dbg_log("file delete(%s)", info->filename);
+ unlink(info->filename);
+ g_free(info->filename);
+ info->filename = NULL;
+ }
+ break;
+
+ case _MMCamcorder_CMD_COMMIT:
+ {
+ int count = 0;
+
+ _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT");
+
+ if (info->b_commiting) {
+ _mmcam_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
+ return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+ } else {
+ _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
+ info->b_commiting = TRUE;
+ }
+
+ for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) {
+ if (info->filesize > 0) {
+ break;
+ } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
+ _mmcam_dbg_err("Commit fail, waited 200 ms, but file size is %lld", info->filesize);
info->b_commiting = FALSE;
- return MM_ERROR_CAMCORDER_INVALID_CONDITION;
- }
- else
- {
- _mmcam_dbg_warn("Commit is Waiting for enough audio frame, retrial count[%d], file size is %" G_GUINT64_FORMAT "",
- count, info->filesize);
- }
- usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
- }
-
- if (audioSrc) {
- GstPad *pad = gst_element_get_static_pad (audioSrc, "src");
-// gst_pad_push_event (pad, gst_event_new_eos());
- ret = gst_element_send_event(audioSrc, gst_event_new_eos());
- gst_object_unref(pad);
- pad = NULL;
- if (_mmcamcorder_get_state((MMHandleType)hcamcorder) == MM_CAMCORDER_STATE_PAUSED) // for pause -> commit case
- {
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- if(ret<0) {
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
- }
- }
-
+ return MM_ERROR_CAMCORDER_INVALID_CONDITION;
+ } else {
+ _mmcam_dbg_warn("Waiting for enough audio frame, re-count[%d], file size is %lld",
+ count, info->filesize);
}
+ usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
+ }
- //wait until finishing EOS
- _mmcam_dbg_log("Start to wait EOS");
- if ((ret =_mmcamcorder_get_eos_message(handle)) != MM_ERROR_NONE)
- {
- goto _ERR_CAMCORDER_AUDIO_COMMAND;
- }
-/*
- while ((!sc->get_eos)&&((retry_cnt--) > 0)) {
- if ((gMessage = gst_bus_timed_pop (bus, timeout)) != NULL)
- {
- if (GST_MESSAGE_TYPE(gMessage) ==GST_MESSAGE_EOS)
- {
- _mmcam_dbg_log("Get a EOS message");
- gst_message_unref(gMessage);
- break;
- }
- else
- {
- _mmcam_dbg_log("Get another message(%x). Post this message to bus again.", GST_MESSAGE_TYPE(gMessage));
- gst_bus_post(bus, gMessage);
- }
+ if (audioSrc) {
+ ret = gst_element_send_event(audioSrc, gst_event_new_eos());
+ /* for pause -> commit case */
+ if (_mmcamcorder_get_state((MMHandleType)hcamcorder) == MM_CAMCORDER_STATE_PAUSED) {
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+ if (ret != MM_ERROR_NONE) {
+ info->b_commiting = FALSE;
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
}
- else
- {
- _mmcam_dbg_log("timeout of gst_bus_timed_pop()");
- break;
- }
-
- usleep(100); //To Prevent busy waiting
}
+ }
- _mmcamcorder_audio_handle_eos((MMHandleType)hcamcorder);
-*/
-
-
+ /* wait until finishing EOS */
+ _mmcam_dbg_log("Start to wait EOS");
+ if ((ret =_mmcamcorder_get_eos_message(handle)) != MM_ERROR_NONE) {
+ info->b_commiting = FALSE;
+ goto _ERR_CAMCORDER_AUDIO_COMMAND;
}
- break;
+ break;
+ }
- case _MMCamcorder_CMD_PREVIEW_START:
- // MM_CAMCORDER_START_CHANGE_STATE;
- break;
- case _MMCamcorder_CMD_PREVIEW_STOP:
- // MM_CAMCORDER_STOP_CHANGE_STATE;
- //void
- break;
+ case _MMCamcorder_CMD_PREVIEW_START:
+ //MM_CAMCORDER_START_CHANGE_STATE;
+ break;
- default:
- ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
- break;
+ case _MMCamcorder_CMD_PREVIEW_STOP:
+ //MM_CAMCORDER_STOP_CHANGE_STATE;
+ //void
+ break;
+
+ default:
+ ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ break;
}
_ERR_CAMCORDER_AUDIO_COMMAND:
return ret;
-
}
-int
-_mmcamcorder_audio_handle_eos(MMHandleType handle)
+int _mmcamcorder_audio_handle_eos(MMHandleType handle)
{
+ int err = MM_ERROR_NONE;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
- _MMCamcorderAudioInfo *info = NULL;
- GstElement *pipeline = NULL;
+ _MMCamcorderAudioInfo *info = NULL;
+ GstElement *pipeline = NULL;
_MMCamcorderMsgItem msg;
MMCamRecordingReport * report;
- int err = MM_ERROR_NONE;
-
mmf_return_val_if_fail(hcamcorder, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, FALSE);
mmf_return_val_if_fail(sc->info_audio, FALSE);
-
+
_mmcam_dbg_err("");
info = sc->info_audio;
- //changing pipeline for display
- pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
-
+ pipeline = sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst;
- __ta__(" _MMCamcorder_CMD_COMMIT:GST_STATE_READY",
err = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
- );
-
- if( err != MM_ERROR_NONE )
- {
- _mmcam_dbg_warn( "Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err );
+ if (err != MM_ERROR_NONE) {
+ _mmcam_dbg_warn("Failed:_MMCamcorder_CMD_COMMIT:GST_STATE_READY. err[%x]", err);
}
-// __ta__(" _MMCamcorder_CMD_COMMIT:GST_STATE_NULL",
-// _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
-// )
-
- //Send message
- //Send recording report to application
+ /* Send recording report message to application */
msg.id = MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED;
-
- report = (MMCamRecordingReport*) malloc(sizeof(MMCamRecordingReport)); //who free this?
- if (!report)
- {
- //think more.
+ report = (MMCamRecordingReport*) malloc(sizeof(MMCamRecordingReport));
+ if (!report) {
_mmcam_dbg_err("Recording report fail(%s). Out of memory.", info->filename);
return FALSE;
}
_mmcamcroder_send_message(handle, &msg);
-
- if(info->bMuxing)
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ if (info->bMuxing) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ } else {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
}
- else
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
- }
- _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
+
+ _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
sc->pipeline_time = 0;
sc->pause_time = 0;
static float
__mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat format)
{
- #define MAX_AMPLITUDE_MEAN_16BIT 23170.115738161934
- #define MAX_AMPLITUDE_MEAN_08BIT 89.803909382810
+ #define MAX_AMPLITUDE_MEAN_16BIT (23170.115738161934)
+ #define MAX_AMPLITUDE_MEAN_08BIT (89.803909382810)
+ #define DEFAULT_DECIBEL (-80.0)
int i = 0;
int depthByte = 0;
short* pcm16 = 0;
char* pcm8 = 0;
- float db = 0.0;
+ float db = DEFAULT_DECIBEL;
float rms = 0.0;
unsigned long long square_sum = 0;
count++;
}
- rms = sqrt( square_sum/count );
-
- if (depthByte == 1)
- db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_08BIT );
- else
- db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_16BIT );
+ if (count > 0) {
+ rms = sqrt( square_sum/count );
+ if (depthByte == 1) {
+ db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_08BIT );
+ } else {
+ db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_16BIT );
+ }
+ }
/*
_mmcam_dbg_log("size[%d],depthByte[%d],count[%d],rms[%f],db[%f]",
_MMCamcorderMsgItem msg;
int err = MM_ERROR_UNKNOWN;
char *err_name = NULL;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstMapInfo mapinfo = GST_MAP_INFO_INIT;
- mmf_return_val_if_fail(hcamcorder, FALSE);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
/* Set volume to audio input */
err = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_name,
MMCAM_AUDIO_FORMAT, &format,
MMCAM_AUDIO_CHANNEL, &channel,
NULL);
- if (err < 0)
- {
+ if (err < 0) {
_mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
- SAFE_FREE (err_name);
+ SAFE_FREE(err_name);
return err;
}
-
- if(volume == 0) //mute
- {
- gst_buffer_map(buffer, &mapinfo, GST_MAP_WRITE);
- memset(mapinfo.data, 0, mapinfo.size);
- gst_buffer_unmap(buffer, &mapinfo);
- }
+
+ gst_buffer_map(buffer, &mapinfo, GST_MAP_READWRITE);
+
+ if(volume == 0){
+ memset(mapinfo.data, 0, mapinfo.size);
+ }
/* Get current volume level of real input stream */
- gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
-// currms = __mmcamcorder_get_RMS(GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer), depth);
- __ta__( "__mmcamcorder_get_decibel",
- curdcb = __mmcamcorder_get_decibel(mapinfo.data, mapinfo.size, format);
- );
+ curdcb = __mmcamcorder_get_decibel(mapinfo.data, mapinfo.size, format);
msg.id = MM_MESSAGE_CAMCORDER_CURRENT_VOLUME;
msg.param.rec_volume_dB = curdcb;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
/* CALL audio stream callback */
- if ((hcamcorder->astream_cb) && buffer && mapinfo.data && mapinfo.size > 0)
+ if ((hcamcorder->astream_cb) && buffer && mapinfo.data && mapinfo.size > 0)
{
MMCamcorderAudioStreamDataType stream;
if (_mmcamcorder_get_state((MMHandleType)hcamcorder) < MM_CAMCORDER_STATE_PREPARE)
{
_mmcam_dbg_warn("Not ready for stream callback");
- gst_buffer_unmap(buffer, &mapinfo);
- return GST_PAD_PROBE_OK;
+ gst_buffer_unmap(buffer, &mapinfo);
+ return GST_PAD_PROBE_OK;
}
/*
GST_BUFFER_DATA(buffer), format, channel, GST_BUFFER_SIZE(buffer), curdcb);
*/
- stream.data = mapinfo.data;
+ stream.data = (void *)mapinfo.data;
stream.format = format;
stream.channel = channel;
- stream.length = mapinfo.size;
- stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000); //nano -> msecond
+ stream.length = mapinfo.size;
+ stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); //nano -> msecond
stream.volume_dB = curdcb;
_MMCAMCORDER_LOCK_ASTREAM_CALLBACK( hcamcorder );
_MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK( hcamcorder );
}
- gst_buffer_unmap(buffer, &mapinfo);
- return GST_PAD_PROBE_OK;
+ gst_buffer_unmap(buffer, &mapinfo);
+ return GST_PAD_PROBE_OK;
}
}
else
{
- _mmcam_dbg_warn("Unknow pad is added, check it : [%s]", GST_PAD_NAME(pad));
+ _mmcam_dbg_warn("Unknow pad is added, check it : [%s]", GST_PAD_NAME(pad));
}
return;
_MMCamcorderSubContext *sc = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
- _MMCamcorderAudioInfo *audioinfo = NULL;
+ _MMCamcorderAudioInfo *audioinfo = NULL;
_MMCamcorderMsgItem msg;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- mmf_return_val_if_fail(hcamcorder, FALSE);
- mmf_return_val_if_fail(buffer, FALSE);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
- mmf_return_val_if_fail(sc && sc->info_audio, FALSE);
- audioinfo = sc->info_audio;
+ mmf_return_val_if_fail(sc && sc->info_audio, GST_PAD_PROBE_DROP);
+ audioinfo = sc->info_audio;
if (sc->isMaxtimePausing || sc->isMaxsizePausing) {
_mmcam_dbg_warn("isMaxtimePausing[%d],isMaxsizePausing[%d]",
sc->isMaxtimePausing, sc->isMaxsizePausing);
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
- buffer_size = gst_buffer_get_size(buffer);
+ buffer_size = gst_buffer_get_size(buffer);
- if (audioinfo->filesize == 0) {
- if (audioinfo->fileformat == MM_FILE_FORMAT_WAV) {
- audioinfo->filesize += 44; /* wave header size */
- } else if (audioinfo->fileformat == MM_FILE_FORMAT_AMR) {
- audioinfo->filesize += 6; /* amr header size */
+ if (audioinfo->filesize == 0) {
+ if (audioinfo->fileformat == MM_FILE_FORMAT_WAV) {
+ audioinfo->filesize += 44; /* wave header size */
+ } else if (audioinfo->fileformat == MM_FILE_FORMAT_AMR) {
+ audioinfo->filesize += 6; /* amr header size */
}
- audioinfo->filesize += buffer_size;
- return GST_PAD_PROBE_OK;
+ audioinfo->filesize += buffer_size;
+ return GST_PAD_PROBE_OK;
}
if (sc->ferror_send) {
_mmcam_dbg_warn("file write error, drop frames");
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
/* get trailer size */
- if (audioinfo->fileformat == MM_FILE_FORMAT_3GP ||
- audioinfo->fileformat == MM_FILE_FORMAT_MP4 ||
- audioinfo->fileformat == MM_FILE_FORMAT_AAC) {
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+ if (audioinfo->fileformat == MM_FILE_FORMAT_3GP ||
+ audioinfo->fileformat == MM_FILE_FORMAT_MP4 ||
+ audioinfo->fileformat == MM_FILE_FORMAT_AAC) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
/*_mmcam_dbg_log("trailer_size %d", trailer_size);*/
} else {
trailer_size = 0; /* no trailer */
}
- filename = audioinfo->filename;
+ filename = audioinfo->filename;
/* to minimizing free space check overhead */
count = count % _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL;
sc->ferror_count++;
}
- return GST_PAD_PROBE_DROP; /* skip this buffer */
+ return GST_PAD_PROBE_DROP; /* skip this buffer */
default: /* succeeded to get free space */
/* check free space for recording */
if (free_space < (guint64)(_MMCAMCORDER_AUDIO_MINIMUM_SPACE + buffer_size + trailer_size)) {
_mmcam_dbg_warn("No more space for recording!!!");
_mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]",
- free_space, audioinfo->filesize);
+ free_space, audioinfo->filesize);
- if (audioinfo->bMuxing) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ if (audioinfo->bMuxing) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
} else {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
}
sc->isMaxsizePausing = TRUE;
msg.id = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- return GST_PAD_PROBE_DROP; /* skip this buffer */
+ return GST_PAD_PROBE_DROP; /* skip this buffer */
}
break;
}
}
- if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(buffer))) {
+ if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) {
_mmcam_dbg_err("Buffer timestamp is invalid, check it");
- return FALSE;
+ return GST_PAD_PROBE_DROP;
}
- rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_TIMESTAMP(buffer));
+ rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer));
/* calculate remained time can be recorded */
- if (audioinfo->max_time > 0 && audioinfo->max_time < (remained_time + rec_pipe_time)) {
- remained_time = audioinfo->max_time - rec_pipe_time;
- } else if (audioinfo->max_size > 0) {
- long double max_size = (long double)audioinfo->max_size;
- long double current_size = (long double)(audioinfo->filesize + buffer_size + trailer_size);
+ if (audioinfo->max_time > 0 && audioinfo->max_time < (remained_time + rec_pipe_time)) {
+ remained_time = audioinfo->max_time - rec_pipe_time;
+ } else if (audioinfo->max_size > 0) {
+ long double max_size = (long double)audioinfo->max_size;
+ long double current_size = (long double)(audioinfo->filesize + buffer_size + trailer_size);
remained_time = (unsigned long long)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
}
/*_mmcam_dbg_log("remained time : %u", remained_time);*/
/* check max size of recorded file */
- if (audioinfo->max_size > 0 &&
- audioinfo->max_size < audioinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
+ if (audioinfo->max_size > 0 &&
+ audioinfo->max_size < audioinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
_mmcam_dbg_warn("Max size!!! Recording is paused.");
_mmcam_dbg_warn("Max [%" G_GUINT64_FORMAT "], file [%" G_GUINT64_FORMAT "], trailer : [%" G_GUINT64_FORMAT "]", \
- audioinfo->max_size, audioinfo->filesize, trailer_size);
+ audioinfo->max_size, audioinfo->filesize, trailer_size);
/* just same as pause status. After blocking two queue, this function will not call again. */
- if (audioinfo->bMuxing) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ if (audioinfo->bMuxing) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
} else {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
}
msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
- msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
+ msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
msg.param.recording_status.remained_time = 0;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- _mmcam_dbg_log("Last filesize sent by message : %d", audioinfo->filesize + trailer_size);
+ _mmcam_dbg_warn("Last filesize sent by message : %d", audioinfo->filesize + trailer_size);
sc->isMaxsizePausing = TRUE;
msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
/* skip this buffer */
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
/* check recording time limit and send recording status message */
- if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) {
+ if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) {
_mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
- rec_pipe_time, audioinfo->max_time);
+ rec_pipe_time, audioinfo->max_time);
- if (audioinfo->bMuxing) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ if (audioinfo->bMuxing) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
} else {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
}
sc->isMaxtimePausing = TRUE;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
/* skip this buffer */
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
/* send message for recording time and recorded file size */
- if (audioinfo->b_commiting == FALSE) {
- audioinfo->filesize += buffer_size;
+ if (audioinfo->b_commiting == FALSE) {
+ audioinfo->filesize += buffer_size;
msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
- msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
+ msg.param.recording_status.filesize = (unsigned long long)((audioinfo->filesize + trailer_size) >> 10);
msg.param.recording_status.remained_time = remained_time;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
} else {
/* skip this buffer if commit process has been started */
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
}
/*-----------------------------------------------------------------------
| LOCAL VARIABLE DEFINITIONS |
-----------------------------------------------------------------------*/
-static int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM] = { 0, };
-static int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM] = { 0, };
-static conf_info_table* conf_main_info_table[CONFIGURE_CATEGORY_MAIN_NUM] = { NULL, };
-static conf_info_table* conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_NUM] = { NULL, };
-
-/*
- * Videosrc element default value
- */
-static type_element _videosrc_element_default = {
- "VideosrcElement",
- "videotestsrc",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * Audiosrc element default value
- */
-static type_int ___audiosrc_default_channel = { "Channel", 1 };
-static type_int ___audiosrc_default_bitrate = { "BitRate", 8000 };
-static type_int ___audiosrc_default_depth = { "Depth", 16 };
-static type_int ___audiosrc_default_blocksize = { "BlockSize", 1280 };
-static type_int* __audiosrc_default_int_array[] = {
- &___audiosrc_default_channel,
- &___audiosrc_default_bitrate,
- &___audiosrc_default_depth,
- &___audiosrc_default_blocksize,
-};
-static type_string ___audiosrc_default_device = { "Device", "default" };
-static type_string* __audiosrc_default_string_array[] = {
- &___audiosrc_default_device,
-};
-static type_element _audiosrc_element_default = {
- "AudiosrcElement",
- "audiotestsrc",
- __audiosrc_default_int_array,
- sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
- __audiosrc_default_string_array,
- sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
-};
-
-static type_element _audiomodemsrc_element_default = {
- "AudiomodemsrcElement",
- "audiotestsrc",
- __audiosrc_default_int_array,
- sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
- __audiosrc_default_string_array,
- sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
-};
-
-
-/*
- * Videosink element default value
- */
-static type_int ___videosink_default_display_id = { "display-id", 3 };
-static type_int ___videosink_default_x = { "x", 0 };
-static type_int ___videosink_default_y = { "y", 0 };
-static type_int ___videosink_default_width = { "width", 800 };
-static type_int ___videosink_default_height = { "height", 480 };
-static type_int ___videosink_default_rotation = { "rotation", 1 };
-static type_int* __videosink_default_int_array[] = {
- &___videosink_default_display_id,
- &___videosink_default_x,
- &___videosink_default_y,
- &___videosink_default_width,
- &___videosink_default_height,
- &___videosink_default_rotation,
-};
-static type_string* __videosink_default_string_array[] = { NULL };
-static type_element _videosink_element_x_default = {
- "VideosinkElementX",
- "xvimagesink",
- __videosink_default_int_array,
- sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
- __videosink_default_string_array,
- sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-static type_element _videosink_element_evas_default = {
- "VideosinkElementEvas",
- "evasimagesink",
- __videosink_default_int_array,
- sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
- __videosink_default_string_array,
- sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-static type_element _videosink_element_gl_default = {
- "VideosinkElementGL",
- "glimagesink",
- __videosink_default_int_array,
- sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
- __videosink_default_string_array,
- sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-static type_element _videosink_element_null_default = {
- "VideosinkElementNull",
- "fakesink",
- __videosink_default_int_array,
- sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
- __videosink_default_string_array,
- sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
-};
-
-/*
- * Videoscale element default value
- */
-static type_element _videoscale_element_default = {
- "VideoscaleElement",
- "videoscale",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * Record sink element default value
- */
-static type_element _recordsink_element_default = {
- "RecordsinkElement",
- "fakesink",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * H263 element default value
- */
-static type_element _h263_element_default = {
- "H263",
- "avenc_h263",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * H264 element default value
- */
-static type_element _h264_element_default = {
- "H264",
- "savsenc_h264",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * H26L element default value
- */
-static type_element _h26l_element_default = {
- "H26L",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MPEG4 element default value
- */
-static type_element _mpeg4_element_default = {
- "MPEG4",
- "avenc_mpeg4",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MPEG1 element default value
- */
-static type_element _mpeg1_element_default = {
- "MPEG1",
- "avenc_mpeg1video",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * THEORA element default value
- */
-static type_element _theora_element_default = {
- "THEORA",
- "theoraenc",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * AMR element default value
- */
-static type_element _amr_element_default = {
- "AMR",
- "secenc_amr",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * G723_1 element default value
- */
-static type_element _g723_1_element_default = {
- "G723_1",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MP3 element default value
- */
-static type_element _mp3_element_default = {
- "MP3",
- "lame",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * AAC element default value
- */
-static type_element _aac_element_default = {
- "AAC",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MMF element default value
- */
-static type_element _mmf_element_default = {
- "MMF",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * ADPCM element default value
- */
-static type_element _adpcm_element_default = {
- "ADPCM",
- "avenc_adpcm_ima_qt",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * WAVE element default value
- */
-static type_element _wave_element_default = {
- "WAVE",
- "wavenc",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-static type_element _vorbis_element_default = {
- "VORBIS",
- "vorbisenc",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MIDI element default value
- */
-static type_element _midi_element_default = {
- "MIDI",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * IMELODY element default value
- */
-static type_element _imelody_element_default = {
- "IMELODY",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * JPEG element default value
- */
-static type_element _jpeg_element_default = {
- "JPEG",
- "secjpeg_enc",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * PNG element default value
- */
-static type_element _png_element_default = {
- "PNG",
- "pngenc",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * BMP element default value
- */
-static type_element _bmp_element_default = {
- "BMP",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * WBMP element default value
- */
-static type_element _wbmp_element_default = {
- "WBMP",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * TIFF element default value
- */
-static type_element _tiff_element_default = {
- "TIFF",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * PCX element default value
- */
-static type_element _pcx_element_default = {
- "PCX",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * GIF element default value
- */
-static type_element _gif_element_default = {
- "GIF",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * ICO element default value
- */
-static type_element _ico_element_default = {
- "ICO",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * RAS element default value
- */
-static type_element _ras_element_default = {
- "RAS",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * TGA element default value
- */
-static type_element _tga_element_default = {
- "TGA",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * XBM element default value
- */
-static type_element _xbm_element_default = {
- "XBM",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * XPM element default value
- */
-static type_element _xpm_element_default = {
- "XPM",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * 3GP element default value
- */
-static type_element _3gp_element_default = {
- "3GP",
- "avmux_3gp",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * AMR mux element default value
- */
-static type_element _amrmux_element_default = {
- "AMR",
- "avmux_amr",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MP4 element default value
- */
-static type_element _mp4_element_default = {
- "MP4",
- "avmux_mp4",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * AAC mux element default value
- */
-static type_element _aacmux_element_default = {
- "AAC",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MP3 mux element default value
- */
-static type_element _mp3mux_element_default = {
- "MP3",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * OGG element default value
- */
-static type_element _ogg_element_default = {
- "OGG",
- "oggmux",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * WAV element default value
- */
-static type_element _wav_element_default = {
- "WAV",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * AVI element default value
- */
-static type_element _avi_element_default = {
- "AVI",
- "avimux",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * WMA element default value
- */
-static type_element _wma_element_default = {
- "WMA",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * WMV element default value
- */
-static type_element _wmv_element_default = {
- "WMV",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MID element default value
- */
-static type_element _mid_element_default = {
- "MID",
- NULL,
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MMF mux element default value
- */
-static type_element _mmfmux_element_default = {
- "MMF",
- "avmux_mmf",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * MATROSKA element default value
- */
-static type_element _matroska_element_default = {
- "MATROSKA",
- "matroskamux",
- NULL,
- 0,
- NULL,
- 0,
-};
-
-/*
- * [General] matching table
- */
-static conf_info_table conf_main_general_table[] = {
- { "SyncStateChange", CONFIGURE_VALUE_INT, {1} },
- { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {(int)NULL} },
- { "ModelName", CONFIGURE_VALUE_STRING, {(int)"Samsung Camera"} },
- { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {(int)NULL} },
-};
-
-/*
- * [VideoInput] matching table
- */
-static conf_info_table conf_main_video_input_table[] = {
- { "UseConfCtrl", CONFIGURE_VALUE_INT, {1} },
- { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {(int)"mmfw_camcorder_dev_video_pri.ini"} },
- { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {(int)"mmfw_camcorder_dev_video_sec.ini"} },
- { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {(int)&_videosrc_element_default} },
- { "UseVideoscale", CONFIGURE_VALUE_INT, {0} },
- { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {(int)&_videoscale_element_default} },
- { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {0} },
- { "DeviceCount", CONFIGURE_VALUE_INT, {MM_VIDEO_DEVICE_NUM} },
-};
-
-/*
- * [AudioInput] matching table
- */
-static conf_info_table conf_main_audio_input_table[] = {
- { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {(int)&_audiosrc_element_default} },
- { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {(int)&_audiomodemsrc_element_default} },
-};
-
-/*
- * [VideoOutput] matching table
- */
-static conf_info_table conf_main_video_output_table[] = {
- { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "VideosinkElementX", CONFIGURE_VALUE_ELEMENT, {(int)&_videosink_element_x_default} },
- { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {(int)&_videosink_element_evas_default} },
- { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {(int)&_videosink_element_gl_default} },
- { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {(int)&_videosink_element_null_default} },
- { "UseVideoscale", CONFIGURE_VALUE_INT, {0} },
- { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {(int)&_videoscale_element_default} },
-};
-
-/*
- * [Capture] matching table
- */
-static conf_info_table conf_main_capture_table[] = {
- { "UseEncodebin", CONFIGURE_VALUE_INT, {0} },
- { "UseCaptureMode", CONFIGURE_VALUE_INT, {0} },
- { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {(int)&_videoscale_element_default} },
- { "PlayCaptureSound", CONFIGURE_VALUE_INT, {1} },
-};
-
-/*
- * [Record] matching table
- */
-static conf_info_table conf_main_record_table[] = {
- { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {1} },
- { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {1} },
- { "VideoProfile", CONFIGURE_VALUE_INT, {0} },
- { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {0} },
- { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {0} },
- { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {0} },
- { "AudioProfile", CONFIGURE_VALUE_INT, {0} },
- { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {0} },
- { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {0} },
- { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {0} },
- { "ImageProfile", CONFIGURE_VALUE_INT, {0} },
- { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {0} },
- { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {0} },
- { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {0} },
- { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {(int)&_recordsink_element_default} },
- { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {0} },
- { "DropVideoFrame", CONFIGURE_VALUE_INT, {0} },
- { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {0} },
-};
-
-/*
- * [VideoEncoder] matching table
- */
-static conf_info_table conf_main_video_encoder_table[] = {
- { "H263", CONFIGURE_VALUE_ELEMENT, {(int)&_h263_element_default} },
- { "H264", CONFIGURE_VALUE_ELEMENT, {(int)&_h264_element_default} },
- { "H26L", CONFIGURE_VALUE_ELEMENT, {(int)&_h26l_element_default} },
- { "MPEG4", CONFIGURE_VALUE_ELEMENT, {(int)&_mpeg4_element_default} },
- { "MPEG1", CONFIGURE_VALUE_ELEMENT, {(int)&_mpeg1_element_default} },
- { "THEORA", CONFIGURE_VALUE_ELEMENT, {(int)&_theora_element_default} },
-};
-
-/*
- * [AudioEncoder] matching table
- */
-static conf_info_table conf_main_audio_encoder_table[] = {
- { "AMR", CONFIGURE_VALUE_ELEMENT, {(int)&_amr_element_default} },
- { "G723_1", CONFIGURE_VALUE_ELEMENT, {(int)&_g723_1_element_default} },
- { "MP3", CONFIGURE_VALUE_ELEMENT, {(int)&_mp3_element_default} },
- { "AAC", CONFIGURE_VALUE_ELEMENT, {(int)&_aac_element_default} },
- { "MMF", CONFIGURE_VALUE_ELEMENT, {(int)&_mmf_element_default} },
- { "ADPCM", CONFIGURE_VALUE_ELEMENT, {(int)&_adpcm_element_default} },
- { "WAVE", CONFIGURE_VALUE_ELEMENT, {(int)&_wave_element_default} },
- { "MIDI", CONFIGURE_VALUE_ELEMENT, {(int)&_midi_element_default} },
- { "IMELODY", CONFIGURE_VALUE_ELEMENT, {(int)&_imelody_element_default} },
- { "VORBIS", CONFIGURE_VALUE_ELEMENT, {(int)&_vorbis_element_default} },
-};
-
-/*
- * [ImageEncoder] matching table
- */
-static conf_info_table conf_main_image_encoder_table[] = {
- { "JPEG", CONFIGURE_VALUE_ELEMENT, {(int)&_jpeg_element_default} },
- { "PNG", CONFIGURE_VALUE_ELEMENT, {(int)&_png_element_default} },
- { "BMP", CONFIGURE_VALUE_ELEMENT, {(int)&_bmp_element_default} },
- { "WBMP", CONFIGURE_VALUE_ELEMENT, {(int)&_wbmp_element_default} },
- { "TIFF", CONFIGURE_VALUE_ELEMENT, {(int)&_tiff_element_default} },
- { "PCX", CONFIGURE_VALUE_ELEMENT, {(int)&_pcx_element_default} },
- { "GIF", CONFIGURE_VALUE_ELEMENT, {(int)&_gif_element_default} },
- { "ICO", CONFIGURE_VALUE_ELEMENT, {(int)&_ico_element_default} },
- { "RAS", CONFIGURE_VALUE_ELEMENT, {(int)&_ras_element_default} },
- { "TGA", CONFIGURE_VALUE_ELEMENT, {(int)&_tga_element_default} },
- { "XBM", CONFIGURE_VALUE_ELEMENT, {(int)&_xbm_element_default} },
- { "XPM", CONFIGURE_VALUE_ELEMENT, {(int)&_xpm_element_default} },
-};
-
-/*
- * [Mux] matching table
- */
-static conf_info_table conf_main_mux_table[] = {
- { "3GP", CONFIGURE_VALUE_ELEMENT, {(int)&_3gp_element_default} },
- { "AMR", CONFIGURE_VALUE_ELEMENT, {(int)&_amrmux_element_default} },
- { "MP4", CONFIGURE_VALUE_ELEMENT, {(int)&_mp4_element_default} },
- { "AAC", CONFIGURE_VALUE_ELEMENT, {(int)&_aacmux_element_default} },
- { "MP3", CONFIGURE_VALUE_ELEMENT, {(int)&_mp3mux_element_default} },
- { "OGG", CONFIGURE_VALUE_ELEMENT, {(int)&_ogg_element_default} },
- { "WAV", CONFIGURE_VALUE_ELEMENT, {(int)&_wav_element_default} },
- { "AVI", CONFIGURE_VALUE_ELEMENT, {(int)&_avi_element_default} },
- { "WMA", CONFIGURE_VALUE_ELEMENT, {(int)&_wma_element_default} },
- { "WMV", CONFIGURE_VALUE_ELEMENT, {(int)&_wmv_element_default} },
- { "MID", CONFIGURE_VALUE_ELEMENT, {(int)&_mid_element_default} },
- { "MMF", CONFIGURE_VALUE_ELEMENT, {(int)&_mmfmux_element_default} },
- { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {(int)&_matroska_element_default} },
-};
-
-
-/*******************
- * Camera control *
- *******************/
-
-/*
- * [Camera] matching table
- */
-static conf_info_table conf_ctrl_camera_table[] = {
- { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "DeviceName", CONFIGURE_VALUE_STRING, {(int)NULL} },
- { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {(int)NULL} },
- { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {(int)NULL} },
- { "FPS", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "Overlay", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {3} },
- { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_YUYV} },
- { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_NV12} },
- { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {(int)NULL} },
- { "FacingDirection", CONFIGURE_VALUE_INT, {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
-};
-
-/*
- * [Strobe] matching table
- */
-static conf_info_table conf_ctrl_strobe_table[] = {
- { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-};
-
-/*
- * [Effect] matching table
- */
-static conf_info_table conf_ctrl_effect_table[] = {
- { "Brightness", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "Contrast", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "Saturation", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "Flip", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "WDR", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-};
-
-/*
- * [Photograph] matching table
- */
-static conf_info_table conf_ctrl_photograph_table[] = {
- { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "AFType", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "AEType", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "ISO", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-};
-
-/*
- * [Capture] matching table
- */
-static conf_info_table conf_ctrl_capture_table[] = {
- { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {1} },
- { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
-};
-
-/*
- * [Detect] matching table
- */
-static conf_info_table conf_ctrl_detect_table[] = {
- { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {(int)NULL} },
- { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
- { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {(int)NULL} },
-};
-
-
-
-char*
-get_new_string( char* src_string )
+char *get_new_string(char* src_string)
{
return strdup(src_string);
}
-void _mmcamcorder_conf_init(int type, camera_conf** configure_info)
+void _mmcamcorder_conf_init(MMHandleType handle, int type, camera_conf** configure_info)
{
int i = 0;
int info_table_size = sizeof(conf_info_table);
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ /* Videosrc element default value */
+ static type_element _videosrc_element_default = {
+ "VideosrcElement",
+ "videotestsrc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* Audiosrc element default value */
+ static type_int ___audiosrc_default_channel = { "Channel", 1 };
+ static type_int ___audiosrc_default_bitrate = { "BitRate", 8000 };
+ static type_int ___audiosrc_default_depth = { "Depth", 16 };
+ static type_int ___audiosrc_default_blocksize = { "BlockSize", 1280 };
+ static type_int* __audiosrc_default_int_array[] = {
+ &___audiosrc_default_channel,
+ &___audiosrc_default_bitrate,
+ &___audiosrc_default_depth,
+ &___audiosrc_default_blocksize,
+ };
+ static type_string ___audiosrc_default_device = { "Device", "default" };
+ static type_string* __audiosrc_default_string_array[] = {
+ &___audiosrc_default_device,
+ };
+ static type_element _audiosrc_element_default = {
+ "AudiosrcElement",
+ "audiotestsrc",
+ __audiosrc_default_int_array,
+ sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
+ __audiosrc_default_string_array,
+ sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
+ };
+
+ static type_element _audiomodemsrc_element_default = {
+ "AudiomodemsrcElement",
+ "audiotestsrc",
+ __audiosrc_default_int_array,
+ sizeof( __audiosrc_default_int_array ) / sizeof( type_int* ),
+ __audiosrc_default_string_array,
+ sizeof( __audiosrc_default_string_array ) / sizeof( type_string* ),
+ };
+
+
+ /* Videosink element default value */
+ static type_int ___videosink_default_display_id = { "display-id", 3 };
+ static type_int ___videosink_default_x = { "x", 0 };
+ static type_int ___videosink_default_y = { "y", 0 };
+ static type_int ___videosink_default_width = { "width", 800 };
+ static type_int ___videosink_default_height = { "height", 480 };
+ static type_int ___videosink_default_rotation = { "rotation", 1 };
+ static type_int* __videosink_default_int_array[] = {
+ &___videosink_default_display_id,
+ &___videosink_default_x,
+ &___videosink_default_y,
+ &___videosink_default_width,
+ &___videosink_default_height,
+ &___videosink_default_rotation,
+ };
+ static type_string* __videosink_default_string_array[] = { NULL };
+ static type_element _videosink_element_x_default = {
+ "VideosinkElementX",
+ "xvimagesink",
+ __videosink_default_int_array,
+ sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+ __videosink_default_string_array,
+ sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+ };
+ static type_element _videosink_element_evas_default = {
+ "VideosinkElementEvas",
+ "evasimagesink",
+ __videosink_default_int_array,
+ sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+ __videosink_default_string_array,
+ sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+ };
+ static type_element _videosink_element_gl_default = {
+ "VideosinkElementGL",
+ "glimagesink",
+ __videosink_default_int_array,
+ sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+ __videosink_default_string_array,
+ sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+ };
+ static type_element _videosink_element_null_default = {
+ "VideosinkElementNull",
+ "fakesink",
+ __videosink_default_int_array,
+ sizeof( __videosink_default_int_array ) / sizeof( type_int* ),
+ __videosink_default_string_array,
+ sizeof( __videosink_default_string_array ) / sizeof( type_string* ),
+ };
+
+ /* Videoscale element default value */
+ static type_element _videoscale_element_default = {
+ "VideoscaleElement",
+ "videoscale",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* Videoconvert element default value */
+ static type_element _videoconvert_element_default = {
+ "VideoconvertElement",
+ "videoconvert",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* Record sink element default value */
+ static type_element _recordsink_element_default = {
+ "RecordsinkElement",
+ "fakesink",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* H263 element default value */
+ static type_element _h263_element_default = {
+ "H263",
+ "avenc_h263",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* H264 element default value */
+ static type_element _h264_element_default = {
+ "H264",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* H26L element default value */
+ static type_element _h26l_element_default = {
+ "H26L",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MPEG4 element default value */
+ static type_element _mpeg4_element_default = {
+ "MPEG4",
+ "avenc_mpeg4",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MPEG1 element default value */
+ static type_element _mpeg1_element_default = {
+ "MPEG1",
+ "avenc_mpeg1video",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* THEORA element default value */
+ static type_element _theora_element_default = {
+ "THEORA",
+ "theoraenc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* AMR element default value */
+ static type_element _amr_element_default = {
+ "AMR",
+ "amrnbenc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* G723_1 element default value */
+ static type_element _g723_1_element_default = {
+ "G723_1",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MP3 element default value */
+ static type_element _mp3_element_default = {
+ "MP3",
+ "lamemp3enc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* AAC element default value */
+ static type_element _aac_element_default = {
+ "AAC",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MMF element default value */
+ static type_element _mmf_element_default = {
+ "MMF",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* ADPCM element default value */
+ static type_element _adpcm_element_default = {
+ "ADPCM",
+ "avenc_adpcm_ima_qt",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* WAVE element default value */
+ static type_element _wave_element_default = {
+ "WAVE",
+ "wavenc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* VORBIS element default value */
+ static type_element _vorbis_element_default = {
+ "VORBIS",
+ "vorbisenc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MIDI element default value */
+ static type_element _midi_element_default = {
+ "MIDI",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* IMELODY element default value */
+ static type_element _imelody_element_default = {
+ "IMELODY",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* JPEG element default value */
+ static type_element _jpeg_element_default = {
+ "JPEG",
+ "jpegenc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* PNG element default value */
+ static type_element _png_element_default = {
+ "PNG",
+ "pngenc",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* BMP element default value */
+ static type_element _bmp_element_default = {
+ "BMP",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* WBMP element default value */
+ static type_element _wbmp_element_default = {
+ "WBMP",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* TIFF element default value */
+ static type_element _tiff_element_default = {
+ "TIFF",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* PCX element default value */
+ static type_element _pcx_element_default = {
+ "PCX",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* GIF element default value */
+ static type_element _gif_element_default = {
+ "GIF",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* ICO element default value */
+ static type_element _ico_element_default = {
+ "ICO",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* RAS element default value */
+ static type_element _ras_element_default = {
+ "RAS",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* TGA element default value */
+ static type_element _tga_element_default = {
+ "TGA",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* XBM element default value */
+ static type_element _xbm_element_default = {
+ "XBM",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* XPM element default value */
+ static type_element _xpm_element_default = {
+ "XPM",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* 3GP element default value */
+ static type_element _3gp_element_default = {
+ "3GP",
+ "avmux_3gp",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* AMR mux element default value */
+ static type_element _amrmux_element_default = {
+ "AMR",
+ "avmux_amr",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MP4 element default value */
+ static type_element _mp4_element_default = {
+ "MP4",
+ "avmux_mp4",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* AAC mux element default value */
+ static type_element _aacmux_element_default = {
+ "AAC",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MP3 mux element default value */
+ static type_element _mp3mux_element_default = {
+ "MP3",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* OGG element default value */
+ static type_element _ogg_element_default = {
+ "OGG",
+ "oggmux",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* WAV element default value */
+ static type_element _wav_element_default = {
+ "WAV",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* AVI element default value */
+ static type_element _avi_element_default = {
+ "AVI",
+ "avimux",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* WMA element default value */
+ static type_element _wma_element_default = {
+ "WMA",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* WMV element default value */
+ static type_element _wmv_element_default = {
+ "WMV",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MID element default value */
+ static type_element _mid_element_default = {
+ "MID",
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MMF mux element default value */
+ static type_element _mmfmux_element_default = {
+ "MMF",
+ "avmux_mmf",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* MATROSKA element default value */
+ static type_element _matroska_element_default = {
+ "MATROSKA",
+ "matroskamux",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* M2TS element default value */
+ static type_element _m2ts_element_default = {
+ "M2TS",
+ "mpegtsmux",
+ NULL,
+ 0,
+ NULL,
+ 0,
+ };
+
+ /* [General] matching table */
+ static conf_info_table conf_main_general_table[] = {
+ { "SyncStateChange", CONFIGURE_VALUE_INT, {1} },
+ { "GSTInitOption", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
+ { "ModelName", CONFIGURE_VALUE_STRING, {NULL} },
+ { "DisabledAttributes", CONFIGURE_VALUE_STRING_ARRAY, {NULL} },
+ };
+
+ /* [VideoInput] matching table */
+ static conf_info_table conf_main_video_input_table[] = {
+ { "UseConfCtrl", CONFIGURE_VALUE_INT, {1} },
+ { "ConfCtrlFile0", CONFIGURE_VALUE_STRING, {0} },
+ { "ConfCtrlFile1", CONFIGURE_VALUE_STRING, {0} },
+ { "VideosrcElement", CONFIGURE_VALUE_ELEMENT, {&_videosrc_element_default} },
+ { "UseVideoscale", CONFIGURE_VALUE_INT, {0} },
+ { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
+ { "UseZeroCopyFormat", CONFIGURE_VALUE_INT, {0} },
+ { "DeviceCount", CONFIGURE_VALUE_INT, {MM_VIDEO_DEVICE_NUM} },
+ { "SupportMediaPacketPreviewCb", CONFIGURE_VALUE_INT, {0} },
+ };
+
+ /* [AudioInput] matching table */
+ static conf_info_table conf_main_audio_input_table[] = {
+ { "AudiosrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiosrc_element_default} },
+ { "AudiomodemsrcElement", CONFIGURE_VALUE_ELEMENT, {&_audiomodemsrc_element_default} },
+ };
+
+ /* [VideoOutput] matching table */
+ static conf_info_table conf_main_video_output_table[] = {
+ { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "VideosinkElementX", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_x_default} },
+ { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_evas_default} },
+ { "VideosinkElementGL", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_gl_default} },
+ { "VideosinkElementNull", CONFIGURE_VALUE_ELEMENT, {&_videosink_element_null_default} },
+ { "UseVideoscale", CONFIGURE_VALUE_INT, {0} },
+ { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
+ { "VideoconvertElement", CONFIGURE_VALUE_ELEMENT, {&_videoconvert_element_default} },
+ };
+
+ /* [Capture] matching table */
+ static conf_info_table conf_main_capture_table[] = {
+ { "UseEncodebin", CONFIGURE_VALUE_INT, {0} },
+ { "UseCaptureMode", CONFIGURE_VALUE_INT, {0} },
+ { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {&_videoscale_element_default} },
+ { "PlayCaptureSound", CONFIGURE_VALUE_INT, {1} },
+ };
+
+ /* [Record] matching table */
+ static conf_info_table conf_main_record_table[] = {
+ { "UseAudioEncoderQueue", CONFIGURE_VALUE_INT, {1} },
+ { "UseVideoEncoderQueue", CONFIGURE_VALUE_INT, {1} },
+ { "VideoProfile", CONFIGURE_VALUE_INT, {0} },
+ { "VideoAutoAudioConvert", CONFIGURE_VALUE_INT, {0} },
+ { "VideoAutoAudioResample", CONFIGURE_VALUE_INT, {0} },
+ { "VideoAutoColorSpace", CONFIGURE_VALUE_INT, {0} },
+ { "AudioProfile", CONFIGURE_VALUE_INT, {0} },
+ { "AudioAutoAudioConvert", CONFIGURE_VALUE_INT, {0} },
+ { "AudioAutoAudioResample", CONFIGURE_VALUE_INT, {0} },
+ { "AudioAutoColorSpace", CONFIGURE_VALUE_INT, {0} },
+ { "ImageProfile", CONFIGURE_VALUE_INT, {0} },
+ { "ImageAutoAudioConvert", CONFIGURE_VALUE_INT, {0} },
+ { "ImageAutoAudioResample", CONFIGURE_VALUE_INT, {0} },
+ { "ImageAutoColorSpace", CONFIGURE_VALUE_INT, {0} },
+ { "RecordsinkElement", CONFIGURE_VALUE_ELEMENT, {&_recordsink_element_default} },
+ { "UseNoiseSuppressor", CONFIGURE_VALUE_INT, {0} },
+ { "DropVideoFrame", CONFIGURE_VALUE_INT, {0} },
+ { "PassFirstVideoFrame", CONFIGURE_VALUE_INT, {0} },
+ { "SupportDualStream", CONFIGURE_VALUE_INT, {FALSE} },
+ };
+
+ /* [VideoEncoder] matching table */
+ static conf_info_table conf_main_video_encoder_table[] = {
+ { "H263", CONFIGURE_VALUE_ELEMENT, {&_h263_element_default} },
+ { "H264", CONFIGURE_VALUE_ELEMENT, {&_h264_element_default} },
+ { "H26L", CONFIGURE_VALUE_ELEMENT, {&_h26l_element_default} },
+ { "MPEG4", CONFIGURE_VALUE_ELEMENT, {&_mpeg4_element_default} },
+ { "MPEG1", CONFIGURE_VALUE_ELEMENT, {&_mpeg1_element_default} },
+ { "THEORA", CONFIGURE_VALUE_ELEMENT, {&_theora_element_default} },
+ };
+
+ /* [AudioEncoder] matching table */
+ static conf_info_table conf_main_audio_encoder_table[] = {
+ { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amr_element_default} },
+ { "G723_1", CONFIGURE_VALUE_ELEMENT, {&_g723_1_element_default} },
+ { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3_element_default} },
+ { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aac_element_default} },
+ { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmf_element_default} },
+ { "ADPCM", CONFIGURE_VALUE_ELEMENT, {&_adpcm_element_default} },
+ { "WAVE", CONFIGURE_VALUE_ELEMENT, {&_wave_element_default} },
+ { "MIDI", CONFIGURE_VALUE_ELEMENT, {&_midi_element_default} },
+ { "IMELODY", CONFIGURE_VALUE_ELEMENT, {&_imelody_element_default} },
+ { "VORBIS", CONFIGURE_VALUE_ELEMENT, {&_vorbis_element_default} },
+ };
+
+ /* [ImageEncoder] matching table */
+ static conf_info_table conf_main_image_encoder_table[] = {
+ { "JPEG", CONFIGURE_VALUE_ELEMENT, {&_jpeg_element_default} },
+ { "PNG", CONFIGURE_VALUE_ELEMENT, {&_png_element_default} },
+ { "BMP", CONFIGURE_VALUE_ELEMENT, {&_bmp_element_default} },
+ { "WBMP", CONFIGURE_VALUE_ELEMENT, {&_wbmp_element_default} },
+ { "TIFF", CONFIGURE_VALUE_ELEMENT, {&_tiff_element_default} },
+ { "PCX", CONFIGURE_VALUE_ELEMENT, {&_pcx_element_default} },
+ { "GIF", CONFIGURE_VALUE_ELEMENT, {&_gif_element_default} },
+ { "ICO", CONFIGURE_VALUE_ELEMENT, {&_ico_element_default} },
+ { "RAS", CONFIGURE_VALUE_ELEMENT, {&_ras_element_default} },
+ { "TGA", CONFIGURE_VALUE_ELEMENT, {&_tga_element_default} },
+ { "XBM", CONFIGURE_VALUE_ELEMENT, {&_xbm_element_default} },
+ { "XPM", CONFIGURE_VALUE_ELEMENT, {&_xpm_element_default} },
+ };
+
+ /* [Mux] matching table */
+ static conf_info_table conf_main_mux_table[] = {
+ { "3GP", CONFIGURE_VALUE_ELEMENT, {&_3gp_element_default} },
+ { "AMR", CONFIGURE_VALUE_ELEMENT, {&_amrmux_element_default} },
+ { "MP4", CONFIGURE_VALUE_ELEMENT, {&_mp4_element_default} },
+ { "AAC", CONFIGURE_VALUE_ELEMENT, {&_aacmux_element_default} },
+ { "MP3", CONFIGURE_VALUE_ELEMENT, {&_mp3mux_element_default} },
+ { "OGG", CONFIGURE_VALUE_ELEMENT, {&_ogg_element_default} },
+ { "WAV", CONFIGURE_VALUE_ELEMENT, {&_wav_element_default} },
+ { "AVI", CONFIGURE_VALUE_ELEMENT, {&_avi_element_default} },
+ { "WMA", CONFIGURE_VALUE_ELEMENT, {&_wma_element_default} },
+ { "WMV", CONFIGURE_VALUE_ELEMENT, {&_wmv_element_default} },
+ { "MID", CONFIGURE_VALUE_ELEMENT, {&_mid_element_default} },
+ { "MMF", CONFIGURE_VALUE_ELEMENT, {&_mmfmux_element_default} },
+ { "MATROSKA", CONFIGURE_VALUE_ELEMENT, {&_matroska_element_default} },
+ { "M2TS", CONFIGURE_VALUE_ELEMENT, {&_m2ts_element_default} },
+ };
+
+
+ /*******************
+ * Camera control *
+ *******************/
+
+ /* [Camera] matching table */
+ static conf_info_table conf_ctrl_camera_table[] = {
+ { "InputIndex", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "DeviceName", CONFIGURE_VALUE_STRING, {NULL} },
+ { "PreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "CaptureResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "VideoResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "FPS", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "PictureFormat", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Overlay", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {3} },
+ { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_YUYV} },
+ { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_NV12} },
+ { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} },
+ { "FacingDirection", CONFIGURE_VALUE_INT, {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR} },
+ };
+
+ /* [Strobe] matching table */
+ static conf_info_table conf_ctrl_strobe_table[] = {
+ { "StrobeControl", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "StrobeMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "StrobeEV", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ };
+
+ /* [Effect] matching table */
+ static conf_info_table conf_ctrl_effect_table[] = {
+ { "Brightness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "BrightnessStepDenominator", CONFIGURE_VALUE_INT, {2} },
+ { "Contrast", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "Saturation", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "Sharpness", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "WhiteBalance", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "ColorTone", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Flip", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "Rotation", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "WDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "PartColorMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "PartColor", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ };
+
+ /* [Photograph] matching table */
+ static conf_info_table conf_ctrl_photograph_table[] = {
+ { "LensInit", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "DigitalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "OpticalZoom", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "FocusMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "AFType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "AEType", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "ExposureValue", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "FNumber", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "ShutterSpeed", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "VideoStabilization", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ };
+
+ /* [Capture] matching table */
+ static conf_info_table conf_ctrl_capture_table[] = {
+ { "OutputMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {1} },
+ { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "SupportZSL", CONFIGURE_VALUE_INT, {FALSE} },
+ };
+
+ /* [Detect] matching table */
+ static conf_info_table conf_ctrl_detect_table[] = {
+ { "DetectMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} },
+ { "DetectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "DetectSelect", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ { "DetectSelectNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} },
+ };
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return;
+ }
+
_mmcam_dbg_log("Entered...");
if (type == CONFIGURE_TYPE_MAIN) {
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
- conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
-
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
- conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
-
- (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_MAIN_NUM );
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = conf_main_video_output_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_CAPTURE] = conf_main_capture_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_RECORD] = conf_main_record_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = conf_main_video_encoder_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = conf_main_audio_encoder_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = conf_main_image_encoder_table;
+ hcamcorder->conf_main_info_table[CONFIGURE_CATEGORY_MAIN_MUX] = conf_main_mux_table;
+
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_GENERAL] = sizeof( conf_main_general_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = sizeof( conf_main_video_input_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = sizeof( conf_main_audio_input_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT] = sizeof( conf_main_video_output_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_CAPTURE] = sizeof( conf_main_capture_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_RECORD] = sizeof( conf_main_record_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER] = sizeof( conf_main_video_encoder_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER] = sizeof( conf_main_audio_encoder_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER] = sizeof( conf_main_image_encoder_table ) / info_table_size;
+ hcamcorder->conf_main_category_size[CONFIGURE_CATEGORY_MAIN_MUX] = sizeof( conf_main_mux_table ) / info_table_size;
+
+ (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_MAIN_NUM );
for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) {
(*configure_info)->info[i] = NULL;
}
} else {
- conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
- conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
- conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
- conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
- conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
- conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
-
- conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
- conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
- conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
- conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
- conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
- conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
-
- (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_CTRL_NUM );
+ hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table;
+ hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table;
+ hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table;
+ hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = conf_ctrl_photograph_table;
+ hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAPTURE] = conf_ctrl_capture_table;
+ hcamcorder->conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_DETECT] = conf_ctrl_detect_table;
+
+ hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAMERA] = sizeof( conf_ctrl_camera_table ) / info_table_size;
+ hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_STROBE] = sizeof( conf_ctrl_strobe_table ) / info_table_size;
+ hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_EFFECT] = sizeof( conf_ctrl_effect_table ) / info_table_size;
+ hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH] = sizeof( conf_ctrl_photograph_table ) / info_table_size;
+ hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_CAPTURE] = sizeof( conf_ctrl_capture_table ) / info_table_size;
+ hcamcorder->conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_DETECT] = sizeof( conf_ctrl_detect_table ) / info_table_size;
+
+ (*configure_info)->info = (conf_detail**)g_malloc0( sizeof( conf_detail* ) * CONFIGURE_CATEGORY_CTRL_NUM );
for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) {
(*configure_info)->info[i] = NULL;
}
-int
-_mmcamcorder_conf_get_info( int type, char* ConfFile, camera_conf** configure_info )
+int _mmcamcorder_conf_get_info(MMHandleType handle, int type, const char* ConfFile, camera_conf** configure_info)
{
int ret = MM_ERROR_NONE;
FILE* fd = NULL;
fd = fopen( conf_path, "r" );
if( fd == NULL )
{
- _mmcam_dbg_warn( "File open failed.[%s] But keep going... All value will be returned as default.Type[%d]",
- conf_path, type );
+ _mmcam_dbg_warn("open failed.[%s] But keep going... Type[%d]", conf_path, type);
}
}
if( fd != NULL )
{
- ret = _mmcamcorder_conf_parse_info( type, fd, configure_info );
+ ret = _mmcamcorder_conf_parse_info( handle, type, fd, configure_info );
fclose( fd );
}
else
return ret;
}
-int
-_mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info )
+int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera_conf** configure_info)
{
const unsigned int BUFFER_NUM_DETAILS = 256;
const unsigned int BUFFER_NUM_TOKEN = 20;
{
_mmcam_dbg_err( "Failed to create new configure structure.type[%d]", type );
*configure_info = NULL;
-
+ SAFE_FREE( buffer_string );
return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
new_conf->type = type;
*configure_info = new_conf;
- _mmcamcorder_conf_init( type, &new_conf );
+ _mmcamcorder_conf_init(handle, type, &new_conf);
+
+ if( fd == NULL )
+ {
+ _mmcam_dbg_err("failed file descriptor fail");
+ SAFE_FREE( buffer_string );
+ SAFE_FREE( new_conf );
+ return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ }
- mmf_return_val_if_fail( fd > 0, MM_ERROR_CAMCORDER_INVALID_ARGUMENT );
-
read_main = 0;
count_main_category = 0;
}
/* Main Category */
else if( *buffer_token[0] == '[' )
- {
+ {
category_name = get_new_string( buffer_token[0] );
count_main_category++;
count_details = 0;
-
+
while( !feof( fd ) )
{
length_read = getline( &buffer_string, &BUFFER_LENGTH_STRING, fd );
}
}
+ /*
_mmcam_dbg_log( "type : %d, category_name : %s, count : [%d]", type, category_name, count_details );
+ */
if( count_details == 0 )
{
/* Details */
if( type == CONFIGURE_TYPE_MAIN )
- {
+ {
if( !strcmp( "[General]", category_name ) )
{
category = CONFIGURE_CATEGORY_MAIN_GENERAL;
if( category != -1 )
{
- _mmcamcorder_conf_add_info( type, &(new_conf->info[category]),
+ _mmcamcorder_conf_add_info( handle, type, &(new_conf->info[category]),
buffer_details, category, count_details );
}
else
}
-void
-_mmcamcorder_conf_release_info( camera_conf** configure_info )
+void _mmcamcorder_conf_release_info(MMHandleType handle, camera_conf** configure_info)
{
int i, j, k, type, count, category_num;
camera_conf* temp_conf = (*configure_info);
- type_int* temp_int;
+ type_int2* temp_int;
type_int_range* temp_int_range;
type_int_array* temp_int_array;
type_int_pair_array* temp_int_pair_array;
- type_string* temp_string;
+ type_string2* temp_string;
type_string_array* temp_string_array;
- type_element* temp_element;
+ type_element2* temp_element;
_mmcam_dbg_log( "Entered..." );
{
continue;
}
-
- if( _mmcamcorder_conf_get_value_type( temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type ) )
+
+ if( _mmcamcorder_conf_get_value_type(handle, temp_conf->type, i, ((type_element*)(temp_conf->info[i]->detail_info[j]))->name, &type))
{
switch( type )
{
case CONFIGURE_VALUE_INT:
{
- temp_int = (type_int*)(temp_conf->info[i]->detail_info[j]);
+ temp_int = (type_int2*)(temp_conf->info[i]->detail_info[j]);
SAFE_FREE( temp_int->name );
}
break;
break;
case CONFIGURE_VALUE_STRING:
{
- temp_string = (type_string*)(temp_conf->info[i]->detail_info[j]);
+ temp_string = (type_string2*)(temp_conf->info[i]->detail_info[j]);
SAFE_FREE( temp_string->name );
SAFE_FREE( temp_string->value );
}
SAFE_FREE( temp_string_array->value[k] );
}
SAFE_FREE( temp_string_array->value );
-
SAFE_FREE( temp_string_array->default_value );
}
break;
case CONFIGURE_VALUE_ELEMENT:
{
- temp_element = (type_element*)(temp_conf->info[i]->detail_info[j]);
+ temp_element = (type_element2*)(temp_conf->info[i]->detail_info[j]);
SAFE_FREE( temp_element->name );
SAFE_FREE( temp_element->element_name );
SAFE_FREE( temp_element->value_string );
}
break;
+ default:
+ _mmcam_dbg_warn("unknown type %d", type);
+ break;
}
}
_mmcam_dbg_log( "Done." );
}
-int
-_mmcamcorder_conf_get_value_type( int type, int category, char* name, int* value_type )
+int _mmcamcorder_conf_get_value_type(MMHandleType handle, int type, int category, const char* name, int* value_type)
{
int i = 0;
int count_value = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return FALSE;
+ }
+
/*_mmcam_dbg_log( "Entered..." );*/
mmf_return_val_if_fail( name, FALSE );
- if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+ if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
{
_mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
- return FALSE;
+ return FALSE;
}
/*_mmcam_dbg_log( "Number of value : [%d]", count_value );*/
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_main_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
{
- *value_type = conf_main_info_table[category][i].value_type;
+ *value_type = hcamcorder->conf_main_info_table[category][i].value_type;
/*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
return TRUE;
}
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
{
- *value_type = conf_ctrl_info_table[category][i].value_type;
+ *value_type = hcamcorder->conf_ctrl_info_table[category][i].value_type;
/*_mmcam_dbg_log( "Category[%d],Name[%s],Type[%d]", category, name, *value_type );*/
return TRUE;
}
}
-int
-_mmcamcorder_conf_add_info( int type, conf_info** info, char** buffer_details, int category, int count_details )
+int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details )
{
const int BUFFER_NUM_TOKEN = 256;
-
+
int i = 0;
int j = 0;
int count_token;
const char *delimiters_3rd = "|\n";
mmf_return_val_if_fail( buffer_details, FALSE );
-
- (*info) = (conf_info*)g_malloc0( sizeof(conf_info) );
+
+ (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
(*info)->detail_info = (void**)g_malloc0(sizeof(void*) * count_details);
(*info)->count = count_details;
continue;
}
- if (!_mmcamcorder_conf_get_value_type(type, category, buffer_token[0], &value_type)) {
+ if (!_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type)) {
(*info)->detail_info[i] = NULL;
_mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
continue;
{
case CONFIGURE_VALUE_INT:
{
- type_int* new_int;
+ type_int2* new_int;
- new_int = (type_int*)g_malloc0( sizeof(type_int) );
+ new_int = (type_int2*)g_malloc0( sizeof(type_int2) );
new_int->name = get_new_string( buffer_token[0] );
new_int->value = atoi( buffer_token[1] );
(*info)->detail_info[i] = (void*)new_int;
(*info)->detail_info[i] = (void*)new_int_range;
/*
_mmcam_dbg_log("INT RANGE - name[%s],min[%d],max[%d],default[%d]",
- new_int_range->name,
- new_int_range->min,
+ new_int_range->name,
+ new_int_range->min,
new_int_range->max,
new_int_range->default_value);
*/
new_int_array->default_value = atoi( buffer_token[count_token-1] );
/*_mmcam_dbg_log(" default value[%d]", new_int_array->default_value);*/
-
+
(*info)->detail_info[i] = (void*)new_int_array;
break;
}
}
case CONFIGURE_VALUE_STRING:
{
- type_string* new_string;
-
- new_string = (type_string*)g_malloc0( sizeof(type_string) );
+ type_string2* new_string;
+
+ new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
new_string->name = get_new_string( buffer_token[0] );
new_string->value = get_new_string( buffer_token[1] );
(*info)->detail_info[i] = (void*)new_string;
-
+
/*_mmcam_dbg_log("STRING - name[%s],value[%s]", new_string->name, new_string->value);*/
break;
}
{
int count_value = count_token - 2;
type_string_array* new_string_array;
-
+
new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
new_string_array->name = get_new_string( buffer_token[0] );
new_string_array->count = count_value;
}
case CONFIGURE_VALUE_ELEMENT:
{
- type_element* new_element;
-
- new_element = (type_element*)g_malloc0( sizeof(type_element) );
+ type_element2* new_element;
+
+ new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
new_element->name = get_new_string( buffer_token[0] );
new_element->element_name = get_new_string( buffer_token[1] );
new_element->count_int = atoi( buffer_token[2] );
/* add int values */
if ( new_element->count_int > 0 ) {
- new_element->value_int = (type_int**)g_malloc0( sizeof(type_int*)*(new_element->count_int) );
+ new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
for ( j = 0 ; j < new_element->count_int ; j++ ) {
- new_element->value_int[j] = (type_int*)g_malloc( sizeof(type_int) );
+ new_element->value_int[j] = (type_int2*)g_malloc( sizeof(type_int2) );
new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
/*
/* add string values */
if ( new_element->count_string > 0 ) {
- new_element->value_string = (type_string**)g_malloc0( sizeof(type_string*)*(new_element->count_string) );
+ new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
for ( ; j < new_element->count_string + new_element->count_int ; j++ ) {
- new_element->value_string[j-new_element->count_int] = (type_string*)g_malloc0( sizeof(type_string) );
+ new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
/*
}
-int
-_mmcamcorder_conf_add_info_with_caps( int type, conf_info** info, char** buffer_details, int category, int count_details )
+int _mmcamcorder_conf_add_info_with_caps(MMHandleType handle, int type, conf_detail** info, char** buffer_details, int category, int count_details)
{
const int BUFFER_NUM_TOKEN = 256;
-
+
int i = 0;
int j = 0;
int count_token = 0;
//_mmcam_dbg_log( "" );
mmf_return_val_if_fail( buffer_details, FALSE );
-
- (*info) = (conf_info*)g_malloc0( sizeof(conf_info) );
- (*info)->detail_info = (void**)g_malloc0( sizeof(void*)*count_details );
- (*info)->count = count_details;
+
+ (*info) = (conf_detail*)g_malloc0( sizeof(conf_detail) );
+ (*info)->detail_info = (void**)g_malloc0( sizeof(void*)*count_details );
+ (*info)->count = count_details;
//g_print( "Count[%d]\n", (*info)->count );
//g_print( "Pointer[%x]\n", (*info) );
for( i = 0 ; i < count_details ; i++ )
{
//_mmcam_dbg_log( "Read line\"%s\"", buffer_details[i] );
-
+
count_token = 0;
token = strtok_r( buffer_details[i], delimiters, &user_ptr );
continue;
}
- if( !_mmcamcorder_conf_get_value_type( type, category, buffer_token[0], &value_type ) )
+ if( !_mmcamcorder_conf_get_value_type(handle, type, category, buffer_token[0], &value_type ) )
{
(*info)->detail_info[i] = NULL;
_mmcam_dbg_warn( "Failed to get value type... check it. Category[%d],Name[%s]", category, buffer_token[0] );
if( value_type != CONFIGURE_VALUE_STRING && value_type != CONFIGURE_VALUE_STRING_ARRAY )
{
token = strtok_r( NULL, delimiters, &user_ptr );
-
+
while( token )
{
buffer_token[count_token] = token;
{
// skip "="
strtok_r( NULL, delimiters_sub, &user_ptr );
-
+
if( value_type == CONFIGURE_VALUE_STRING_ARRAY )
- {
+ {
token = strtok_r( NULL, delimiters_sub, &user_ptr );
-
+
while( token )
{
buffer_token[count_token] = token;
else // CONFIGURE_VALUE_STRING
{
token = strtok_r( NULL, delimiters_3rd, &user_ptr );
-
+
if( token )
{
g_strchug( token );
case CONFIGURE_VALUE_INT:
{
type_int* new_int;
-
+
new_int = (type_int*)g_malloc0( sizeof(type_int) );
new_int->name = get_new_string( buffer_token[0] );
new_int->value = atoi( buffer_token[1] );
(*info)->detail_info[i] = (void*)new_int;
-
+
//_mmcam_dbg_log( "INT - name[%s],value[%d]", new_int->name, new_int->value );
break;
}
case CONFIGURE_VALUE_INT_RANGE:
{
type_int_range* new_int_range;
-
+
new_int_range = (type_int_range*)g_malloc0( sizeof(type_int_range) );
new_int_range->name = get_new_string( buffer_token[0] );
new_int_range->min = atoi( buffer_token[1] );
{
int count_value = count_token - 2;
type_int_array* new_int_array;
-
+
new_int_array = (type_int_array*)g_malloc0( sizeof(type_int_array) );
new_int_array->name = get_new_string( buffer_token[0] );
new_int_array->value = (int*)g_malloc0( sizeof(int)*count_value );
new_int_array->default_value = atoi( buffer_token[count_token-1] );
//_mmcam_dbg_log( " default value[%d]", new_int_array->default_value );
-
+
(*info)->detail_info[i] = (void*)new_int_array;
break;
}
{
int count_value = ( count_token - 3 ) >> 1;
type_int_pair_array* new_int_pair_array;
-
+
new_int_pair_array = (type_int_pair_array*)g_malloc0( sizeof(type_int_pair_array) );
new_int_pair_array->name = get_new_string( buffer_token[0] );
new_int_pair_array->value[0] = (int*)g_malloc( sizeof(int)*(count_value) );
new_int_pair_array->default_value[1] = atoi( buffer_token[count_token-1] );
/*
- _mmcam_dbg_log( " default value[%d,%d]",
- new_int_pair_array->default_value[0],
- new_int_pair_array->default_value[1] );
+ _mmcam_dbg_log("default value[%d,%d]",
+ new_int_pair_array->default_value[0],
+ new_int_pair_array->default_value[1]);
*/
-
(*info)->detail_info[i] = (void*)new_int_pair_array;
break;
- }
+ }
case CONFIGURE_VALUE_STRING:
{
- type_string* new_string;
-
- new_string = (type_string*)g_malloc0( sizeof(type_string) );
+ type_string2* new_string;
+
+ new_string = (type_string2*)g_malloc0( sizeof(type_string2) );
new_string->name = get_new_string( buffer_token[0] );
new_string->value = get_new_string( buffer_token[1] );
(*info)->detail_info[i] = (void*)new_string;
-
+
//_mmcam_dbg_log( "STRING - name[%s],value[%s]", new_string->name, new_string->value );
break;
- }
+ }
case CONFIGURE_VALUE_STRING_ARRAY:
{
int count_value = count_token - 2;
type_string_array* new_string_array;
-
+
new_string_array = (type_string_array*)g_malloc0( sizeof(type_string_array) );
new_string_array->name = get_new_string( buffer_token[0] );
new_string_array->count = count_value;
new_string_array->default_value = get_new_string( buffer_token[count_token-1] );
//_mmcam_dbg_log( " default value[%s]", new_string_array->default_value );
-
+
(*info)->detail_info[i] = (void*)new_string_array;
break;
}
case CONFIGURE_VALUE_ELEMENT:
{
- type_element* new_element;
-
- new_element = (type_element*)g_malloc0( sizeof(type_element) );
+ type_element2* new_element;
+
+ new_element = (type_element2*)g_malloc0( sizeof(type_element2) );
new_element->name = get_new_string( buffer_token[0] );
new_element->element_name = get_new_string( buffer_token[1] );
new_element->count_int = atoi( buffer_token[2] );
new_element->value_int = NULL;
new_element->count_string = atoi( buffer_token[3] );
new_element->value_string = NULL;
-
+
//_mmcam_dbg_log( "Element - name[%s],element_name[%s],count_int[%d],count_string[%d]", new_element->name, new_element->element_name, new_element->count_int, new_element->count_string );
/* add int values */
if( new_element->count_int > 0 )
{
- new_element->value_int = (type_int**)g_malloc0( sizeof(type_int*)*(new_element->count_int) );
-
+ new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) );
+
for( j = 0 ; j < new_element->count_int ; j++ )
{
- new_element->value_int[j] = (type_int*)g_malloc( sizeof(type_int) );
+ new_element->value_int[j] = (type_int2*)g_malloc( sizeof(type_int2) );
new_element->value_int[j]->name = get_new_string( buffer_token[4+(j<<1)] );
new_element->value_int[j]->value = atoi( buffer_token[5+(j<<1)] );
//_mmcam_dbg_log( " Element INT[%d] - name[%s],value[%d]", j, new_element->value_int[j]->name, new_element->value_int[j]->value );
/* add string values */
if( new_element->count_string > 0 )
{
- new_element->value_string = (type_string**)g_malloc0( sizeof(type_string*)*(new_element->count_string) );
-
+ new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) );
+
for( ; j < new_element->count_string + new_element->count_int ; j++ )
{
- new_element->value_string[j-new_element->count_int] = (type_string*)g_malloc0( sizeof(type_string) );
+ new_element->value_string[j-new_element->count_int] = (type_string2*)g_malloc0( sizeof(type_string2) );
new_element->value_string[j-new_element->count_int]->name = get_new_string( buffer_token[4+(j<<1)] );
new_element->value_string[j-new_element->count_int]->value = get_new_string( buffer_token[5+(j<<1)] );
//_mmcam_dbg_log( " Element STRING[%d] - name[%s],value[%s]", j-new_element->count_int, new_element->value_string[j-new_element->count_int]->name, new_element->value_string[j-new_element->count_int]->value );
(*info)->detail_info[i] = (void*)new_element;
break;
- }
+ }
default:
break;
- }
+ }
}
//_mmcam_dbg_log( "Done." );
}
-int
-_mmcamcorder_conf_get_value_int( camera_conf* configure_info, int category, char* name, int* value )
+int _mmcamcorder_conf_get_value_int(MMHandleType handle, camera_conf* configure_info, int category, const char* name, int* value)
{
int i, count;
- conf_info* info;
+ conf_detail* info;
//_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
if( configure_info->info[category] )
{
- count = configure_info->info[category]->count;
- info = configure_info->info[category];
-
+ count = configure_info->info[category]->count;
+ info = configure_info->info[category];
+
for( i = 0 ; i < count ; i++ )
{
if( info->detail_info[i] == NULL )
{
continue;
}
-
+
if( !strcmp( ((type_int*)(info->detail_info[i]))->name , name ) )
{
*value = ((type_int*)(info->detail_info[i]))->value;
}
}
- if( _mmcamcorder_conf_get_default_value_int( configure_info->type, category, name, value ) )
+ if( _mmcamcorder_conf_get_default_value_int( handle, configure_info->type, category, name, value ) )
{
//_mmcam_dbg_log( "Get[%s] int[%d]", name, *value );
return TRUE;
}
int
-_mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, char* name, type_int_range** value )
+_mmcamcorder_conf_get_value_int_range( camera_conf* configure_info, int category, const char* name, type_int_range** value )
{
int i, count;
- conf_info* info;
+ conf_detail* info;
//_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
if( configure_info->info[category] )
{
- count = configure_info->info[category]->count;
- info = configure_info->info[category];
-
+ count = configure_info->info[category]->count;
+ info = configure_info->info[category];
+
for( i = 0 ; i < count ; i++ )
{
if( info->detail_info[i] == NULL )
{
continue;
}
-
+
if( !strcmp( ((type_int_range*)(info->detail_info[i]))->name , name ) )
{
*value = (type_int_range*)(info->detail_info[i]);
/*
- _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
+ _mmcam_dbg_log( "Get[%s] int range - min[%d],max[%d],default[%d]",
name, (*value)->min, (*value)->max, (*value)->default_value );
*/
return TRUE;
}
int
-_mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, char* name, type_int_array** value )
+_mmcamcorder_conf_get_value_int_array( camera_conf* configure_info, int category, const char* name, type_int_array** value )
{
int i, count;
- conf_info* info;
+ conf_detail* info;
- //_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
+ /*_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );*/
mmf_return_val_if_fail( configure_info, FALSE );
mmf_return_val_if_fail( name, FALSE );
{
continue;
}
-
+
if( !strcmp( ((type_int_array*)(info->detail_info[i]))->name , name ) )
{
*value = (type_int_array*)(info->detail_info[i]);
/*
- _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
+ _mmcam_dbg_log( "Get[%s] int array - [%x],count[%d],default[%d]",
name, (*value)->value, (*value)->count, (*value)->default_value );
*/
return TRUE;
}
int
-_mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, char* name, type_int_pair_array** value )
+_mmcamcorder_conf_get_value_int_pair_array( camera_conf* configure_info, int category, const char* name, type_int_pair_array** value )
{
int i, count;
- conf_info* info;
+ conf_detail* info;
//_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
if( configure_info->info[category] )
{
- count = configure_info->info[category]->count;
- info = configure_info->info[category];
-
+ count = configure_info->info[category]->count;
+ info = configure_info->info[category];
+
for( i = 0 ; i < count ; i++ )
{
if( info->detail_info[i] == NULL )
{
continue;
}
-
+
if( !strcmp( ((type_int_pair_array*)(info->detail_info[i]))->name , name ) )
{
*value = (type_int_pair_array*)(info->detail_info[i]);
/*
- _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
- name, (*value)->value[0], (*value)->value[1], (*value)->count,
+ _mmcam_dbg_log( "Get[%s] int pair array - [%x][%x],count[%d],default[%d][%d]",
+ name, (*value)->value[0], (*value)->value[1], (*value)->count,
(*value)->default_value[0], (*value)->default_value[1] );
*/
return TRUE;
return FALSE;
}
-int
-_mmcamcorder_conf_get_value_string( camera_conf* configure_info, int category, char* name, char** value )
+int _mmcamcorder_conf_get_value_string(MMHandleType handle, camera_conf* configure_info, int category, const char* name, const char** value)
{
int i, count;
- conf_info* info;
-
+ conf_detail* info;
+
//_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
mmf_return_val_if_fail( configure_info, FALSE );
mmf_return_val_if_fail( name, FALSE );
-
+
if( configure_info->info[category] )
{
- count = configure_info->info[category]->count;
- info = configure_info->info[category];
-
+ count = configure_info->info[category]->count;
+ info = configure_info->info[category];
+
for( i = 0 ; i < count ; i++ )
{
if( info->detail_info[i] == NULL )
{
continue;
}
-
+
if( !strcmp( ((type_string*)(info->detail_info[i]))->name , name ) )
{
*value = ((type_string*)(info->detail_info[i]))->value;
}
}
- if( _mmcamcorder_conf_get_default_value_string( configure_info->type, category, name, value ) )
+ if( _mmcamcorder_conf_get_default_value_string(handle, configure_info->type, category, name, value ) )
{
//_mmcam_dbg_log( "Get[%s]string[%s]", name, *value );
return TRUE;
}
int
-_mmcamcorder_conf_get_value_string_array ( camera_conf* configure_info, int category, char* name, type_string_array** value )
+_mmcamcorder_conf_get_value_string_array( camera_conf* configure_info, int category, const char* name, type_string_array** value )
{
int i, count;
- conf_info* info;
+ conf_detail* info;
//_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
if( configure_info->info[category] )
{
- count = configure_info->info[category]->count;
- info = configure_info->info[category];
+ count = configure_info->info[category]->count;
+ info = configure_info->info[category];
for( i = 0 ; i < count ; i++ )
{
{
continue;
}
-
+
if( !strcmp( ((type_string_array*)(info->detail_info[i]))->name , name ) )
{
*value = (type_string_array*)(info->detail_info[i]);
/*
- _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
+ _mmcam_dbg_log( "Get[%s] string array - [%x],count[%d],default[%s]",
name, (*value)->value, (*value)->count, (*value)->default_value );
*/
return TRUE;
return FALSE;
}
-int
-_mmcamcorder_conf_get_element( camera_conf* configure_info, int category, char* name, type_element** element )
+int _mmcamcorder_conf_get_element(MMHandleType handle, camera_conf* configure_info, int category, const char* name, type_element** element)
{
int i, count;
- conf_info* info;
-
+ conf_detail* info;
+
//_mmcam_dbg_log( "Entered... category[%d],name[%s]", category, name );
mmf_return_val_if_fail( configure_info, FALSE );
if( configure_info->info[category] )
{
- count = configure_info->info[category]->count;
- info = configure_info->info[category];
-
+ count = configure_info->info[category]->count;
+ info = configure_info->info[category];
+
for( i = 0 ; i < count ; i++ )
{
if( info->detail_info[i] == NULL )
{
continue;
}
-
+
if( !strcmp( ((type_element*)(info->detail_info[i]))->name , name ) )
{
*element = (type_element*)(info->detail_info[i]);
}
}
- if( _mmcamcorder_conf_get_default_element( configure_info->type, category, name, element ) )
+ if( _mmcamcorder_conf_get_default_element(handle, configure_info->type, category, name, element ) )
{
//_mmcam_dbg_log( "Get[%s] element[%x]", name, *element );
return TRUE;
}
int
-_mmcamcorder_conf_get_value_element_name( type_element* element, char** value )
+_mmcamcorder_conf_get_value_element_name( type_element* element, const char** value )
{
//_mmcam_dbg_log( "Entered..." );
}
int
-_mmcamcorder_conf_get_value_element_int( type_element* element, char* name, int* value )
+_mmcamcorder_conf_get_value_element_int( type_element* element, const char* name, int* value )
{
int i;
-
+
//_mmcam_dbg_log( "Entered..." );
-
+
mmf_return_val_if_fail( element, FALSE );
mmf_return_val_if_fail( name, FALSE );
}
}
- _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
+ _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
element->name, name, element->count_int );
return FALSE;
}
int
-_mmcamcorder_conf_get_value_element_string( type_element* element, char* name, char** value )
+_mmcamcorder_conf_get_value_element_string( type_element* element, const char* name, const char** value )
{
int i;
-
+
//_mmcam_dbg_log( "Entered..." );
-
+
mmf_return_val_if_fail( element, FALSE );
mmf_return_val_if_fail( name, FALSE );
}
}
- _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
+ _mmcam_dbg_warn( "Faild to get int in element... ElementName[%p],Name[%s],Count[%d]",
element->name, name, element->count_string );
return FALSE;
for( i = 0 ; i < element->count_int ; i++ )
{
MMCAMCORDER_G_OBJECT_SET( gst, element->value_int[i]->name, element->value_int[i]->value );
-
+
_mmcam_dbg_log( "Element[%s] Set[%s] -> integer[%d]",
element->element_name,
element->value_int[i]->name,
}
int
-_mmcamcorder_conf_get_default_value_int( int type, int category, char* name, int* value )
+_mmcamcorder_conf_get_default_value_int(MMHandleType handle, int type, int category, const char* name, int* value )
{
int i = 0;
int count_value = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return FALSE;
+ }
+
//_mmcam_dbg_log( "Entered..." );
-
+
mmf_return_val_if_fail( name, FALSE );
- if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+ if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
{
_mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
- return FALSE;
+ return FALSE;
}
if( type == CONFIGURE_TYPE_MAIN )
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_main_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
{
- *value = conf_main_info_table[category][i].value_int;
+ *value = hcamcorder->conf_main_info_table[category][i].value_int;
return TRUE;
}
}
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
{
- *value = conf_ctrl_info_table[category][i].value_int;
+ *value = hcamcorder->conf_ctrl_info_table[category][i].value_int;
return TRUE;
}
- }
+ }
}
_mmcam_dbg_warn( "Failed to get default int... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
return FALSE;
}
-int
-_mmcamcorder_conf_get_default_value_string( int type, int category, char* name, char** value )
+int _mmcamcorder_conf_get_default_value_string(MMHandleType handle, int type, int category, const char* name, const char** value)
{
int i = 0;
int count_value = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return FALSE;
+ }
+
//_mmcam_dbg_log( "Entered..." );
-
+
mmf_return_val_if_fail( name, FALSE );
- if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+ if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
{
_mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
- return FALSE;
+ return FALSE;
}
if( type == CONFIGURE_TYPE_MAIN )
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_main_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
{
- *value = conf_main_info_table[category][i].value_string;
+ *value = hcamcorder->conf_main_info_table[category][i].value_string;
_mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
return TRUE;
}
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
{
- *value = conf_ctrl_info_table[category][i].value_string;
+ *value = hcamcorder->conf_ctrl_info_table[category][i].value_string;
_mmcam_dbg_log( "Get[%s] default string[%s]", name, *value );
return TRUE;
}
_mmcam_dbg_warn( "Failed to get default string... check it... Type[%d],Category[%d],Name[%s]", type, category, name );
- return FALSE;
+ return FALSE;
}
-int
-_mmcamcorder_conf_get_default_element( int type, int category, char* name, type_element** element )
+int _mmcamcorder_conf_get_default_element(MMHandleType handle, int type, int category, const char* name, type_element** element)
{
int i = 0;
int count_value = 0;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return FALSE;
+ }
+
//_mmcam_dbg_log( "Entered..." );
-
+
mmf_return_val_if_fail( name, FALSE );
- if( !_mmcamcorder_conf_get_category_size( type, category, &count_value ) )
+ if( !_mmcamcorder_conf_get_category_size( handle, type, category, &count_value ) )
{
_mmcam_dbg_warn( "No matched category... check it... categoty[%d]", category );
- return FALSE;
+ return FALSE;
}
if( type == CONFIGURE_TYPE_MAIN )
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_main_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_main_info_table[category][i].name, name ) )
{
- *element = conf_main_info_table[category][i].value_element;
+ *element = hcamcorder->conf_main_info_table[category][i].value_element;
_mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
return TRUE;
}
{
for( i = 0 ; i < count_value ; i++ )
{
- if( !strcmp( conf_ctrl_info_table[category][i].name, name ) )
+ if( !strcmp( hcamcorder->conf_ctrl_info_table[category][i].name, name ) )
{
- *element = conf_ctrl_info_table[category][i].value_element;
+ *element = hcamcorder->conf_ctrl_info_table[category][i].value_element;
_mmcam_dbg_log( "Get[%s] element[%p]", name, *element );
return TRUE;
}
return FALSE;
}
-int
-_mmcamcorder_conf_get_category_size( int type, int category, int* size )
+int _mmcamcorder_conf_get_category_size(MMHandleType handle, int type, int category, int* size)
{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("handle is NULL");
+ return FALSE;
+ }
+
// mmf_return_val_if_fail( conf_main_category_size, FALSE );
// mmf_return_val_if_fail( conf_ctrl_category_size, FALSE );
{
mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_MAIN_NUM, FALSE );
- *size = (int)conf_main_category_size[category];
+ *size = (int)hcamcorder->conf_main_category_size[category];
}
else
{
mmf_return_val_if_fail( category < CONFIGURE_CATEGORY_CTRL_NUM, FALSE );
- *size = (int)conf_ctrl_category_size[category];
+ *size = (int)hcamcorder->conf_ctrl_category_size[category];
}
- return TRUE;
+ return TRUE;
}
void
-_mmcamcorder_conf_print_info( camera_conf** configure_info )
+_mmcamcorder_conf_print_info(MMHandleType handle, camera_conf** configure_info )
{
int i, j, k, type, category_type;
g_print( "[ConfigureInfo] : Category [%d]\n", i );
for( j = 0 ; j < (*configure_info)->info[i]->count ; j++ )
{
- if( _mmcamcorder_conf_get_value_type( (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
+ if( _mmcamcorder_conf_get_value_type(handle, (*configure_info)->type, i, ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, &type ) )
{
switch( type )
{
for( k = 0 ; k < temp_element->count_string ; k++ )
{
g_print( " - STRING[%d] Name[%s],Value[%s]\n", k, temp_element->value_string[k]->name, temp_element->value_string[k]->value );
- }
+ }
break;
default:
g_print( "[ConfigureInfo] : Not matched value type... So can not print data... check it... Name[%s],type[%d]\n", ((type_int*)((*configure_info)->info[i]->detail_info[j]))->name, type );
{
g_print( "[ConfigureInfo] : Failed to get value type." );
}
- }
+ }
}
}
__mmcamcorder_get_audio_codec_element(MMHandleType handle)
{
type_element *telement = NULL;
- char * codec_type_str = NULL;
+ const char *codec_type_str = NULL;
int codec_type = MM_AUDIO_CODEC_INVALID;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
-
+
mmf_return_val_if_fail(hcamcorder, NULL);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, NULL);
-
+
_mmcam_dbg_log("");
/* Check element availability */
{
case MM_AUDIO_CODEC_AMR:
codec_type_str = "AMR";
- break;
+ break;
case MM_AUDIO_CODEC_G723_1:
codec_type_str = "G723_1";
break;
return NULL;
}
- _mmcamcorder_conf_get_element( hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
- codec_type_str,
- &telement );
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_AUDIO_ENCODER,
+ codec_type_str,
+ &telement);
return telement;
}
__mmcamcorder_get_video_codec_element(MMHandleType handle)
{
type_element *telement = NULL;
- char * codec_type_str = NULL;
+ const char *codec_type_str = NULL;
int codec_type = MM_VIDEO_CODEC_INVALID;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
-
+
mmf_return_val_if_fail(hcamcorder, NULL);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, NULL);
-
+
_mmcam_dbg_log("");
/* Check element availability */
case MM_VIDEO_CODEC_MPEG1:
codec_type_str = "MPEG1";
break;
- case MM_VIDEO_CODEC_THEORA: // OGG
+ case MM_VIDEO_CODEC_THEORA:
codec_type_str = "THEORA";
break;
default:
return NULL;
}
- _mmcamcorder_conf_get_element( hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
- codec_type_str,
- &telement );
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_ENCODER,
+ codec_type_str,
+ &telement);
return telement;
}
__mmcamcorder_get_image_codec_element(MMHandleType handle)
{
type_element *telement = NULL;
- char * codec_type_str = NULL;
+ const char *codec_type_str = NULL;
int codec_type = MM_IMAGE_CODEC_INVALID;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
-
+
mmf_return_val_if_fail(hcamcorder, NULL);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, NULL);
-
+
_mmcam_dbg_log("");
/* Check element availability */
return NULL;
}
- _mmcamcorder_conf_get_element( hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
- codec_type_str,
- &telement );
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_IMAGE_ENCODER,
+ codec_type_str,
+ &telement);
return telement;
}
__mmcamcorder_get_file_format_element(MMHandleType handle)
{
type_element *telement = NULL;
- char * mux_type_str = NULL;
+ const char *mux_type_str = NULL;
int file_type = MM_FILE_FORMAT_INVALID;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
-
+
mmf_return_val_if_fail(hcamcorder, NULL);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, NULL);
-
+
_mmcam_dbg_log("");
/* Check element availability */
case MM_FILE_FORMAT_MATROSKA:
mux_type_str = "MATROSKA";
break;
+ case MM_FILE_FORMAT_M2TS:
+ mux_type_str = "M2TS";
+ break;
default:
_mmcam_dbg_err( "Not supported file format[%d]", file_type );
return NULL;
}
- _mmcamcorder_conf_get_element( hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_MUX,
- mux_type_str,
- &telement );
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_MUX,
+ mux_type_str,
+ &telement);
return telement;
}
type_element *telement = NULL;
_mmcam_dbg_log("type:%d", type);
-
+
switch(type)
{
case MM_CAM_AUDIO_ENCODER:
}
-int _mmcamcorder_get_audio_codec_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_audio_codec_format(MMHandleType handle, const char *name)
{
int codec_index = MM_AUDIO_CODEC_INVALID;
-int _mmcamcorder_get_video_codec_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_video_codec_format(MMHandleType handle, const char *name)
{
int codec_index = MM_VIDEO_CODEC_INVALID;
-int _mmcamcorder_get_image_codec_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_image_codec_format(MMHandleType handle, const char *name)
{
int codec_index = MM_IMAGE_CODEC_INVALID;
}
-int _mmcamcorder_get_mux_format(MMHandleType handle, char *name)
+int _mmcamcorder_get_mux_format(MMHandleType handle, const char *name)
{
int mux_index = MM_FILE_FORMAT_INVALID;
mux_index = MM_FILE_FORMAT_MMF;
} else if (!strcmp(name, "MATROSKA")) {
mux_index = MM_FILE_FORMAT_MATROSKA;
+ } else if (!strcmp(name, "M2TS")) {
+ mux_index = MM_FILE_FORMAT_M2TS;
+
}
_mmcam_dbg_log("mux index %d", mux_index);
int
-_mmcamcorder_get_format(MMHandleType handle, int conf_category, char * name)
+_mmcamcorder_get_format(MMHandleType handle, int conf_category, const char *name)
{
int fmt = -1;
camera_conf* configure_info = NULL;
int *arr = NULL;
int total_count = 0;
-
+
mmf_return_val_if_fail(hcamcorder, 0);
-
+
_mmcam_dbg_log("conf_category:%d", conf_category);
configure_info = hcamcorder->conf_main;
if (configure_info->info[conf_category]) {
int i = 0;
int fmt = 0;
- char *name = NULL;
+ const char *name = NULL;
int count = configure_info->info[conf_category]->count;
- conf_info *info = configure_info->info[conf_category];
+ conf_detail *info = configure_info->info[conf_category];
_mmcam_dbg_log("count[%d], info[%p]", count, info);
* limitations under the License.
*
*/
-
+
#include "mm_camcorder_exifinfo.h"
#include "mm_camcorder_exifdef.h"
+#include "mm_camcorder_internal.h"
#include <libexif/exif-loader.h>
#include <libexif/exif-utils.h>
#define JPEG_MAX_SIZE 20000000
#define JPEG_THUMBNAIL_MAX_SIZE (128*1024)
#define JPEG_DATA_OFFSET 2
+#define JPEG_EXIF_OFFSET 4
#define EXIF_MARKER_SOI_LENGTH 2
#define EXIF_MARKER_APP1_LENGTH 2
#define EXIF_APP1_LENGTH 2
+
#if MM_EXIFINFO_USE_BINARY_EXIFDATA
/**
* Exif Binary Data.
unsigned long ret;
int i;
- // mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
-
m[0] = marker >> 8;
m[1] = marker & 0x00FF;
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s] marker: 0x%02X 0x%02X\n\n", __LINE__, __func__,m[0], m[1]);
+ _mmcam_dbg_log("marker: 0x%02X 0x%02X", m[0], m[1]);
- if (*src == 0xff && *(src + 1) == 0xd8)
+ if (*src == 0xff && *(src + 1) == 0xd8)
{
p = src + 2; /* SOI(start of image) */
- }
- else
+ }
+ else
{
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] invalid JPEG file.\n", __LINE__, __func__);
+ _mmcam_dbg_log("invalid JPEG file.");
return 0UL;
}
- for (i = 0; i < src_sz - (1 + 2); i++, p++)
+ for (i = 0; i < src_sz - (1 + 2); i++, p++)
{
- if (*p == 0xff)
+ if (*p == 0xff)
{
/*marker is 0xFFxx*/
- if (*(p + 1) == m[1])
+ if (*(p + 1) == m[1])
{
ret = p - src;
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]marker offset: %lu %p %p.\n", __LINE__, __func__,ret, (p+1), src);
+ _mmcam_dbg_log("marker offset: %lu %p %p.",ret, (p+1), src);
return ret;
}
- }
+ }
}
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]Marker not found.\n", __LINE__, __func__);
+ _mmcam_dbg_log("Marker not found.");
return 0UL;
}
#endif /* _MMCAMCORDER_EXIF_GET_JPEG_MARKER_OFFSET */
{
ExifData *ed = NULL;
- //mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
-
ed = exif_data_new_from_data(info->data, info->size);
if( ed == NULL )
{
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]Null exif data. (ed:%p)\n", __LINE__, __func__, ed);
+ _mmcam_dbg_log("Null exif data. (ed:%p)", ed);
}
return ed;
unsigned char size[2];
unsigned int i;
- //mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
-
/*get ExifData from info*/
loader = exif_loader_new ();
if (!exif)
{
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]exif Null\n", __LINE__, __func__);
+ _mmcam_dbg_log("exif Null");
return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
}
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]exif(ifd :%p)\n", __LINE__, __func__, exif->ifd);
+ _mmcam_dbg_log("exif(ifd :%p)", exif->ifd);
if(info->data)
{
- free (info->data);
- info->data = NULL;
- info->size = 0;
+ free (info->data);
+ info->data = NULL;
+ info->size = 0;
}
exif_data_save_data (exif, &eb, &ebs);
if(eb==NULL)
{
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]MM_ERROR_CAMCORDER_LOW_MEMORY\n", __LINE__, __func__);
+ _mmcam_dbg_log("MM_ERROR_CAMCORDER_LOW_MEMORY");
return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
info->data = eb;
int
-mm_exif_set_add_entry (ExifData *exif, ExifIfd ifd, ExifTag tag,ExifFormat format,unsigned long components,unsigned char* data)
+mm_exif_set_add_entry (ExifData *exif, ExifIfd ifd, ExifTag tag,ExifFormat format,unsigned long components, const char* data)
{
- /*mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);*/
ExifData *ed = (ExifData *)exif;
ExifEntry *e = NULL;
if (exif == NULL || format <= 0 || components <= 0 || data == NULL) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s] invalid argument exif=%p format=%d, components=%lu data=%p!\n",
- __LINE__, __func__,exif,format,components,data);
+ _mmcam_dbg_err("invalid argument exif=%p format=%d, components=%lu data=%p!",
+ exif,format,components,data);
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
/*create new tag*/
e = exif_entry_new();
if (e == NULL) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s] entry create error!\n", __LINE__, __func__);
+ _mmcam_dbg_err("entry create error!");
return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
unsigned char *eb = NULL;
unsigned int ebs;
#endif
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__);
+ _mmcam_dbg_log("");
if (!info) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s] NULL pointer\n", __LINE__, __func__);
+ _mmcam_dbg_err("NULL pointer");
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
x = malloc(sizeof(mm_exif_info_t));
if (!x) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]malloc error\n", __LINE__, __func__);
+ _mmcam_dbg_err("malloc error");
return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
#if MM_EXIFINFO_USE_BINARY_EXIFDATA
x->data = NULL;
x->data = malloc(_EXIF_BIN_SIZE_);
if (!x->data) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]malloc error\n", __LINE__, __func__);
+ _mmcam_dbg_err("malloc error");
free(x);
return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
#else
ed = exif_data_new();
if (!ed) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]exif data new error\n", __LINE__, __func__);
+ _mmcam_dbg_err("exif data new error");
return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
exif_data_save_data(ed, &eb, &ebs);
if (eb == NULL) {
- mmf_debug(MMF_DEBUG_ERROR,"[%05d][%s]exif_data_save_data error\n", __LINE__, __func__);
+ _mmcam_dbg_err("exif_data_save_data error");
free(x->data);
free(x);
exif_data_unref(ed);
#endif
*info = x;
- mmf_debug(MMF_DEBUG_LOG, "%s() Data:%p Size:%d\n", __func__, x->data, x->size);
+ _mmcam_dbg_log("Data:%p Size:%d", x->data, x->size);
return MM_ERROR_NONE;
}
void
mm_exif_destory_exif_info (mm_exif_info_t *info)
{
- //mmf_debug (MMF_DEBUG_LOG, "%s()\n", __func__);
+ //_mmcam_dbg_log( "");
#if MM_EXIFINFO_USE_BINARY_EXIFDATA
if (info) {
- if (info->data)
+ if (info->data)
free (info->data);
free (info);
}
#else
if (info) {
- if (info->data)
+ if (info->data)
exif_mem_free (info->data);
free (info);
}
int ret = MM_ERROR_NONE;
int cntl = 0;
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s] Thumbnail size:%d, width:%d, height:%d\n", __LINE__, __func__, len, width, height);
+ _mmcam_dbg_log("Thumbnail size:%d, width:%d, height:%d", len, width, height);
if( len > JPEG_THUMBNAIL_MAX_SIZE )
{
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] Thumbnail size[%d] over!!! Skip inserting thumbnail...\n", __LINE__, __func__, len);
+ _mmcam_dbg_err("Thumbnail size[%d] over!!! Skip inserting thumbnail...", len);
return MM_ERROR_NONE;
}
ed->size = len;
/* set thumbnail data */
- p_compressed = malloc(sizeof(ExifShort));
+ p_compressed = (unsigned char *)malloc(sizeof(ExifShort));
if (p_compressed != NULL) {
exif_set_short(p_compressed, exif_data_get_byte_order(ed), 6);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_COMPRESSION, EXIF_FORMAT_SHORT, 1, p_compressed);
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_COMPRESSION, EXIF_FORMAT_SHORT, 1, (const char *)p_compressed);
if (ret != MM_ERROR_NONE) {
goto exit;
}
/* set thumbnail size */
exif_set_long ((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), width);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_WIDTH, EXIF_FORMAT_LONG, 1, (unsigned char*)&elong[cntl++]);
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_WIDTH, EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
goto exit;
}
exif_set_long ((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), height);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_LENGTH, EXIF_FORMAT_LONG, 1, (unsigned char*)&elong[cntl++]);
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_1, EXIF_TAG_IMAGE_LENGTH, EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
goto exit;
}
ed->data = NULL;
ed->size = 0;
- exif_data_unref (ed);
+ exif_data_unref (ed);
exit :
if(p_compressed != NULL)
}
-int mm_exif_mnote_create (ExifData *exif)
-{
- ExifData* ed = exif;
- ExifDataOption o = 0;
- if(!ed){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] invalid argument exif=%p \n", __LINE__, __func__,ed);
- return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
- }
-
- if(!exif_data_mnote_data_new(ed, MAKER_SAMSUNG, o )){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_mnote_data_samsung_new() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_CREATION;
- }
-
- return MM_ERROR_NONE;
-}
-
-
-int mm_exif_mnote_set_add_entry (ExifData *exif, MnoteSamsungTag tag, int index, int subindex1, int subindex2)
-{
- ExifData *ed = exif;
- ExifMnoteData *md;
-
- ExifShort product_id = 32768; //should be modified
- char serialNum[] = "SerialNum123"; //should be modified
-
- if(!ed){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] invalid argument exif=%p \n", __LINE__, __func__,ed);
- return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
- }
-
- md = exif_data_get_mnote_data (ed);
- if(!md){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_get_mnote_data() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_CREATION;
- }
-
- if(!exif_data_mnote_set_mem_for_adding_entry(md, MAKER_SAMSUNG)){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_mem_for_adding_entry() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_MALLOC;
- }
-
- exif_mnote_data_set_byte_order(md, (ExifByteOrder) exif_data_get_data_order(ed));
-
- switch(tag){
- case MNOTE_SAMSUNG_TAG_MNOTE_VERSION:
- if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_UNDEFINED, 4, index)){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
- }
- break;
- case MNOTE_SAMSUNG_TAG_DEVICE_ID:
- if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, index)){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
- }
- break;
- case MNOTE_SAMSUNG_TAG_MODEL_ID:
- if(!exif_data_mnote_set_add_entry_subtag(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, MNOTE_SAMSUNG_SUBTAG_MODEL_ID_CLASS, subindex1, MNOTE_SAMSUNG_SUBTAG_MODEL_ID_DEVEL, subindex2, product_id )){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry_subtag() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
- }
- break;
- case MNOTE_SAMSUNG_TAG_COLOR_INFO:
- case MNOTE_SAMSUNG_TAG_SERIAL_NUM:
- if(!exif_data_mnote_set_add_entry_string(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_ASCII, strlen(serialNum), serialNum)){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry_string() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
- }
- break;
- case MNOTE_SAMSUNG_TAG_IMAGE_COUNT:
- case MNOTE_SAMSUNG_TAG_GPS_INFO01:
- case MNOTE_SAMSUNG_TAG_GPS_INFO02:
- case MNOTE_SAMSUNG_TAG_PREVIEW_IMAGE:
- case MNOTE_SAMSUNG_TAG_FAVOR_TAGGING:
- case MNOTE_SAMSUNG_TAG_SRW_COMPRESS:
- case MNOTE_SAMSUNG_TAG_COLOR_SPACE:
- if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, index)){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
- }
- break;
- case MNOTE_SAMSUNG_TAG_AE:
- case MNOTE_SAMSUNG_TAG_AF:
- case MNOTE_SAMSUNG_TAG_AWB01:
- case MNOTE_SAMSUNG_TAG_AWB02:
- case MNOTE_SAMSUNG_TAG_IPC:
- case MNOTE_SAMSUNG_TAG_SCENE_RESULT:
- case MNOTE_SAMSUNG_TAG_SADEBUG_INFO01:
- case MNOTE_SAMSUNG_TAG_SADEBUG_INFO02:
- case MNOTE_SAMSUNG_TAG_FACE_DETECTION:
- if(!exif_data_mnote_set_add_entry(md, MAKER_SAMSUNG, tag, EXIF_FORMAT_LONG, 1, index)){
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s] exif_data_mnote_set_add_entry() failed. \n", __LINE__, __func__);
- return MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY;
- }
- break;
- case MNOTE_SAMSUNG_TAG_FACE_FEAT01:
- case MNOTE_SAMSUNG_TAG_FACE_FEAT02:
- case MNOTE_SAMSUNG_TAG_FACE_RECOG:
- case MNOTE_SAMSUNG_TAG_LENS_INFO:
- case MNOTE_SAMSUNG_TAG_THIRDPARTY:
- break;
- default:
- break;
- }
- return MM_ERROR_NONE;
-}
-
-
int
mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info, void *jpeg, int jpeg_len)
{
unsigned char *eb = NULL;
unsigned int ebs;
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__);
+ _mmcam_dbg_log("");
eb = info->data;
ebs = info->size;
/*create file*/
fp = fopen (filename, "wb");
if (!fp) {
- mmf_debug (MMF_DEBUG_ERROR, "%s(), fopen() failed [%s].\n", __func__, filename);
+ _mmcam_dbg_err( "fopen() failed [%s].", filename);
return MM_ERROR_IMAGE_FILEOPEN;
}
if(head[0]==0 || head[1]==0 || head_len==0)
{
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]setting error\n", __LINE__, __func__);
+ _mmcam_dbg_err("setting error");
fclose (fp);
return -1;
}
unsigned short head_len = 0;
unsigned char *eb = NULL;
unsigned int ebs;
+ int jpeg_offset = JPEG_DATA_OFFSET;
+ mm_exif_info_t *test_exif_info = NULL;
/*output*/
unsigned char *m = NULL;
int m_len = 0;
- mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__);
+ _mmcam_dbg_log("");
if(info==NULL || jpeg==NULL)
{
- mmf_debug (MMF_DEBUG_ERROR, "%s(), MM_ERROR_CAMCORDER_INVALID_ARGUMENT info=%p, jpeg=%p\n", __func__,info,jpeg);
+ _mmcam_dbg_err( "MM_ERROR_CAMCORDER_INVALID_ARGUMENT info=%p, jpeg=%p",info,jpeg);
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
if(jpeg_len>JPEG_MAX_SIZE)
{
- mmf_debug (MMF_DEBUG_ERROR, "%s(),jpeg_len is worng jpeg_len=%d\n", __func__,jpeg_len);
- return MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG;
+ _mmcam_dbg_err( "jpeg_len is worng jpeg_len=%d",jpeg_len);
+ return MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG;
}
eb = info->data;
ebs = info->size;
+ /* check EXIF in JPEG */
+ if (mm_exif_load_exif_info(&test_exif_info, jpeg, jpeg_len) == MM_ERROR_NONE) {
+ if (test_exif_info) {
+ jpeg_offset = test_exif_info->size + JPEG_EXIF_OFFSET;
+ if (test_exif_info->data) {
+ free(test_exif_info->data);
+ test_exif_info->data = NULL;
+ }
+ free(test_exif_info);
+ test_exif_info = NULL;
+ } else {
+ _mmcam_dbg_err("test_exif_info is NULL");
+ }
+ } else {
+ _mmcam_dbg_warn("no EXIF in JPEG");
+ }
+
/*length of output image*/
/*SOI + APP1 + length of APP1 + length of EXIF + IMAGE*/
- m_len = EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs + (jpeg_len - JPEG_DATA_OFFSET);
+ m_len = EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs + (jpeg_len - jpeg_offset);
/*alloc output image*/
m = malloc (m_len);
if (!m) {
- mmf_debug (MMF_DEBUG_ERROR, "%s(), malloc() failed.\n", __func__);
- return MM_ERROR_CAMCORDER_LOW_MEMORY;
+ _mmcam_dbg_err( "malloc() failed.");
+ return MM_ERROR_CAMCORDER_LOW_MEMORY;
}
/*set SOI, APP1*/
/*set header length*/
_exif_set_uint16 (0, &head_len, (unsigned short)(ebs + 2));
if (head[0] == 0 || head[1] == 0 || head_len == 0) {
- mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]setting error\n", __LINE__, __func__);
+ _mmcam_dbg_err("setting error");
free(m);
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
eb, ebs);
/*IMAGE*/
memcpy(m + EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs,
- jpeg + JPEG_DATA_OFFSET, jpeg_len - JPEG_DATA_OFFSET);
+ jpeg + jpeg_offset, jpeg_len - jpeg_offset);
- mmf_debug(MMF_DEBUG_LOG,"[%05d][%s] JPEG+EXIF Copy DONE(original:%d, copied:%d)\n",
- __LINE__, __func__, jpeg_len, jpeg_len - JPEG_DATA_OFFSET);
+ _mmcam_dbg_log("JPEG+EXIF Copy DONE(original:%d, offset:%d, copied:%d)",
+ jpeg_len, jpeg_offset, jpeg_len - jpeg_offset);
/*set ouput param*/
*mem = m;
return MM_ERROR_NONE;
}
+
+
+int mm_exif_load_exif_info(mm_exif_info_t **info, void *jpeg_data, int jpeg_length)
+{
+ ExifLoader *loader = NULL;
+ const unsigned char *b = NULL;
+ unsigned int s = 0;
+ mm_exif_info_t *x = NULL;
+ // TODO : get exif and re-set exif
+ loader = exif_loader_new();
+ if (loader) {
+ exif_loader_write (loader, jpeg_data, jpeg_length);
+ exif_loader_get_buf (loader, &b, &s);
+ if (s > 0) {
+ x = malloc(sizeof(mm_exif_info_t));
+ if (x) {
+ x->data = malloc(s);
+ memcpy((char*)x->data, b, s);
+ x->size = s;
+ *info = x;
+ _mmcam_dbg_warn("load EXIF : data %p, size %d", x->data, x->size);
+ } else {
+ _mmcam_dbg_err("mm_exif_info_t malloc failed");
+ }
+ } else {
+ _mmcam_dbg_err("exif_loader_get_buf failed");
+ }
+
+ /* The loader is no longer needed--free it */
+ exif_loader_unref(loader);
+ loader = NULL;
+ } else {
+ _mmcam_dbg_err("exif_loader_new failed");
+ }
+
+ if (x) {
+ return MM_ERROR_NONE;
+ } else {
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+}
-----------------------------------------------------------------------*/
/* Table for compatibility between audio codec and file format */
gboolean audiocodec_fileformat_compatibility_table[MM_AUDIO_CODEC_NUM][MM_FILE_FORMAT_NUM] =
-{ /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG */
-/*AMR*/ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G723.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MP3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*OGG*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*WMA*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MMF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*ADPCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*WAVE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*WAVE_NEW*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MIDI*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*IMELODY*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MXMF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPA*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MP2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G711*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G722*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G722.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G722.2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G723*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G726*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G728*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G729*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G729A*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*G729.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*REAL*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC_LC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC_MAIN*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC_SRS*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC_LTP*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC_HE_V1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AAC_HE_V2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AC3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*ALAC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*ATRAC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*SPEEX*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*VORBIS*/ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AIFF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AU*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*NONE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*PCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*ALAW*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MULAW*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MS_ADPCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+{ /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG FLAC M2TS*/
+/*AMR*/ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G723.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MP3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*OGG*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
+/*WMA*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MMF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*ADPCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*WAVE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*WAVE_NEW*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MIDI*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*IMELODY*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MXMF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPA*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MP2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G711*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G722*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G722.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G722.2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G723*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G726*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G728*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G729*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G729A*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*G729.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*REAL*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC_LC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC_MAIN*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC_SRS*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC_LTP*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC_HE_V1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AAC_HE_V2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AC3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
+/*ALAC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*ATRAC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*SPEEX*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*VORBIS*/ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AIFF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AU*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*NONE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*PCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*ALAW*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MULAW*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MS_ADPCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
};
/* Table for compatibility between video codec and file format */
gboolean videocodec_fileformat_compatibility_table[MM_VIDEO_CODEC_NUM][MM_FILE_FORMAT_NUM] =
-{ /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG */
-/*NONE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H263*/ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H264*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H26L*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*WMV*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*DIVX*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*XVID*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H261*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H262*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H263V2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*H263V3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MJPEG*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_SIMPLE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_ADV*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_MAIN*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_CORE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_ACE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_ARTS*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*MPEG4_AVC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*REAL*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*VC1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*AVS*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*CINEPAK*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*INDEO*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
-/*THEORA*/ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+{ /* 3GP ASF AVI MATROSKA MP4 OGG NUT QT REAL AMR AAC MP3 AIFF AU WAV MID MMF DIVX FLV VOB IMELODY WMA WMV JPG FLAC M2TS*/
+/*NONE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*H263*/ { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*H264*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
+/*H26L*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
+/*MPEG1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*WMV*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*DIVX*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*XVID*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*H261*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*H262*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*H263V2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*H263V3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MJPEG*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_SIMPLE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_ADV*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_MAIN*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_CORE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_ACE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_ARTS*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*MPEG4_AVC*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*REAL*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*VC1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*AVS*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*CINEPAK*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*INDEO*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+/*THEORA*/ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
};
| LOCAL VARIABLE DEFINITIONS for internal |
-----------------------------------------------------------------------*/
#define USE_AUDIO_CLOCK_TUNE
-#define _MMCAMCORDER_WAIT_EOS_TIME 5.0 /* sec */
-#define _MMCAMCORDER_CONVERT_OUTPUT_BUFFER_NUM 6
+#define _MMCAMCORDER_WAIT_EOS_TIME 60.0 /* sec */
+#define _MMCAMCORDER_CONVERT_OUTPUT_BUFFER_NUM 6
+#define _MMCAMCORDER_MIN_TIME_TO_PASS_FRAME 30000000 /* ns */
+#define _MMCAMCORDER_FRAME_PASS_MIN_FPS 30
+#define _MMCAMCORDER_NANOSEC_PER_1SEC 1000000000
+#define _MMCAMCORDER_NANOSEC_PER_1MILISEC 1000
+#define _MMCAMCORDER_VIDEO_DECODER_NAME "avdec_h264"
+
/*-----------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
* @see __mmcamcorder_create_preview_pipeline()
*/
static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
-
+static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
static int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate);
+static guint32 _mmcamcorder_convert_fourcc_string_to_value(const gchar* format_name);
/*=======================================================================================
| FUNCTION DEFINITIONS |
/*-----------------------------------------------------------------------
| GLOBAL FUNCTION DEFINITIONS: |
-----------------------------------------------------------------------*/
-int _mmcamcorder_create_videosrc_bin(MMHandleType handle)
+int _mmcamcorder_create_preview_elements(MMHandleType handle)
{
int err = MM_ERROR_NONE;
- int rotate = 0;
- int flip = 0;
+ int i = 0;
+ int camera_width = 0;
+ int camera_height = 0;
+ int camera_rotate = 0;
+ int camera_flip = 0;
int fps = 0;
- int hold_af = 0;
- int UseVideoscale = 0;
int codectype = 0;
int capture_width = 0;
int capture_height = 0;
int capture_jpg_quality = 100;
int video_stabilization = 0;
int anti_shake = 0;
- char *videosrc_name = NULL;
+ const char *videosrc_name = NULL;
+ const char *videosink_name = NULL;
char *err_name = NULL;
- unsigned int pix_fourcc = 0;
GList *element_list = NULL;
- GstCaps *caps = NULL;
- GstPad *video_tee0 = NULL;
- GstPad *video_tee1 = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
_mmcam_dbg_log("");
/* Check existence */
- if (sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst) {
- if (((GObject *)sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst)->ref_count > 0) {
- gst_object_unref(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst);
+ for (i = _MMCAMCORDER_VIDEOSRC_SRC ; i <= _MMCAMCORDER_VIDEOSINK_SINK ; i++) {
+ if (sc->element[i].gst) {
+ if (((GObject *)sc->element[i].gst)->ref_count > 0) {
+ gst_object_unref(sc->element[i].gst);
+ }
+ _mmcam_dbg_log("element[index:%d] is Already existed.", i);
}
- _mmcam_dbg_log("_MMCAMCORDER_VIDEOSRC_BIN is Already existed.");
}
/* Get video device index info */
_mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAMERA,
"InputIndex",
- &input_index );
+ &input_index);
if (input_index == NULL) {
_mmcam_dbg_err("Failed to get input_index");
return MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
}
err = mm_camcorder_get_attributes(handle, &err_name,
+ MMCAM_CAMERA_WIDTH, &camera_width,
+ MMCAM_CAMERA_HEIGHT, &camera_height,
MMCAM_CAMERA_FORMAT, &sc->info_image->preview_format,
MMCAM_CAMERA_FPS, &fps,
- MMCAM_CAMERA_ROTATION, &rotate,
- MMCAM_CAMERA_FLIP, &flip,
+ MMCAM_CAMERA_ROTATION, &camera_rotate,
+ MMCAM_CAMERA_FLIP, &camera_flip,
MMCAM_CAMERA_VIDEO_STABILIZATION, &video_stabilization,
MMCAM_CAMERA_ANTI_HANDSHAKE, &anti_shake,
MMCAM_CAPTURE_WIDTH, &capture_width,
MMCAM_CAPTURE_HEIGHT, &capture_height,
+ MMCAM_CAMERA_HDR_CAPTURE, &sc->info_image->hdr_capture_mode,
MMCAM_IMAGE_ENCODER, &codectype,
MMCAM_IMAGE_ENCODER_QUALITY, &capture_jpg_quality,
- "camera-hold-af-after-capturing", &hold_af,
NULL);
if (err != MM_ERROR_NONE) {
_mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
}
/* Get fourcc from picture format */
- pix_fourcc= _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
- strncpy(sc->format_name, (char*)&pix_fourcc, sizeof(pix_fourcc));
- sc->format_name[sizeof(pix_fourcc)] = '\0';
+ sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
/* Get videosrc element and its name from configure */
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"VideosrcElement",
&VideosrcElement);
_mmcamcorder_conf_get_value_element_name(VideosrcElement, &videosrc_name);
- /* Create bin element */
- __ta__(" videosrc_bin",
- _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_VIDEOSRC_BIN, "videosrc_bin", err);
- );
+ /**
+ * Create child element
+ */
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_SRC, videosrc_name, "videosrc_src", element_list, err);
- /* Create child element */
- __ta__(" videosrc_src",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_SRC, videosrc_name, "videosrc_src", element_list, err);
- );
- __ta__(" videosrc_capsfilter",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_FILT, "capsfilter", "videosrc_filter", element_list, err);
- );
- __ta__(" videosrc_queue",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_QUE, "queue", "videosrc_queue", element_list, err);
- );
+ /* Set video device index */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "camera-id", input_index->default_value);
+
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_FILT, "capsfilter", "videosrc_filter", element_list, err);
/* init high-speed-fps */
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", capture_width);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", capture_height);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-jpg-quality", capture_jpg_quality);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", sc->info_image->hdr_capture_mode);
- /* set camera flip */
- _mmcamcorder_set_videosrc_flip(handle, flip);
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_QUE, "queue", "videosrc_queue", element_list, err);
- /* set flush cache as FALSE */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", FALSE);
- }
+ /* set camera flip */
+ _mmcamcorder_set_videosrc_flip(handle, camera_flip);
/* set video stabilization mode */
_mmcamcorder_set_videosrc_stabilization(handle, video_stabilization);
/* set anti handshake mode */
_mmcamcorder_set_videosrc_anti_shake(handle, anti_shake);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "UseVideoscale",
- &UseVideoscale);
- if (UseVideoscale) {
- int set_width = 0;
- int set_height = 0;
- int scale_width = 0;
- int scale_height = 0;
- int scale_method = 0;
- char *videoscale_name = NULL;
- type_element *VideoscaleElement = NULL;
-
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "VideoscaleElement",
- &VideoscaleElement);
- _mmcamcorder_conf_get_value_element_name(VideoscaleElement, &videoscale_name);
- __ta__(" videosrc_scale",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_SCALE, videoscale_name, "videosrc_scale", element_list, err);
- );
- __ta__(" videoscale_capsfilter",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_VSFLT, "capsfilter", "videosrc_scalefilter", element_list, err);
- );
-
- _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "width", &scale_width);
- _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "height", &scale_height);
- _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "method", &scale_method);
-
- if (rotate == MM_VIDEO_INPUT_ROTATION_90 ||
- rotate == MM_VIDEO_INPUT_ROTATION_270) {
- set_width = scale_height;
- set_height = scale_width;
- } else {
- set_width = scale_width;
- set_height = scale_height;
- }
-
- _mmcam_dbg_log("VideoSRC Scale[%dx%d], Method[%d]", set_width, set_height, scale_method);
-
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, sc->format_name,
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- NULL);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_VSFLT].gst, "caps", caps);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SCALE].gst, "method", scale_method);
-
- gst_caps_unref(caps);
- caps = NULL;
- }
-
if (sc->is_modified_rate) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
}
- __ta__(" tee",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_TEE, "tee", "videosrc_tee", element_list, err);
- );
-
/* Set basic infomation of videosrc element */
_mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, VideosrcElement);
- /* Set video device index */
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "camera-id", input_index->default_value);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", hold_af);
+ /* make demux and decoder for H264 stream from videosrc */
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, _MMCAMCORDER_VIDEO_DECODER_NAME, "videosrc_decode", element_list, err);
+ }
_mmcam_dbg_log("Current mode[%d]", hcamcorder->type);
- /* Set sensor mode as CAMERA */
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "sensor-mode", 0);
-
- /* Set caps by rotation */
- _mmcamcorder_set_videosrc_rotation(handle, rotate);
+ /* Get videosink name */
+ _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
- if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst), element_list)) {
- _mmcam_dbg_err( "element add error." );
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
- }
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_QUE, "queue", "videosink_queue", element_list, err);
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSINK_SINK, videosink_name, "videosink_sink", element_list, err);
- if (!_mmcamcorder_link_elements(element_list)) {
- _mmcam_dbg_err( "element link error." );
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
+ if (strcmp(videosink_name, "fakesink") != 0) {
+ if (_mmcamcorder_videosink_window_set(handle, sc->VideosinkElement) != MM_ERROR_NONE) {
+ _mmcam_dbg_err("_mmcamcorder_videosink_window_set error");
+ err = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ goto pipeline_creation_error;
+ }
}
- video_tee0 = gst_element_get_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src_%u");
- video_tee1 = gst_element_get_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src_%u");
+ /* Set caps by rotation */
+ _mmcamcorder_set_videosrc_rotation(handle, camera_rotate);
- MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst), "alloc-pad", video_tee0);
+ _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, sc->VideosinkElement);
- /* Ghost pad */
- if ((gst_element_add_pad( sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, gst_ghost_pad_new("src0", video_tee0) )) < 0) {
- _mmcam_dbg_err("failed to create ghost pad1 on _MMCAMCORDER_VIDEOSRC_BIN.");
- gst_object_unref(video_tee0);
- video_tee0 = NULL;
- gst_object_unref(video_tee1);
- video_tee1 = NULL;
- err = MM_ERROR_CAMCORDER_GST_LINK;
+ /* add elements to main pipeline */
+ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), element_list)) {
+ _mmcam_dbg_err("element_list add error.");
+ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
goto pipeline_creation_error;
}
- if ((gst_element_add_pad( sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, gst_ghost_pad_new("src1", video_tee1) )) < 0) {
- _mmcam_dbg_err("failed to create ghost pad2 on _MMCAMCORDER_VIDEOSRC_BIN.");
- gst_object_unref(video_tee0);
- video_tee0 = NULL;
- gst_object_unref(video_tee1);
- video_tee1 = NULL;
+ /* link elements */
+ if (!_mmcamcorder_link_elements(element_list)) {
+ _mmcam_dbg_err( "element link error." );
err = MM_ERROR_CAMCORDER_GST_LINK;
goto pipeline_creation_error;
}
- gst_object_unref(video_tee0);
- video_tee0 = NULL;
- gst_object_unref(video_tee1);
- video_tee1 = NULL;
-
if (element_list) {
g_list_free(element_list);
element_list = NULL;
return MM_ERROR_NONE;
pipeline_creation_error:
- _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_SRC );
- _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_FILT );
- _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_SCALE );
- _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_VSFLT );
- _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_TEE );
- _MMCAMCORDER_ELEMENT_REMOVE( sc, _MMCAMCORDER_VIDEOSRC_BIN );
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_SRC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_FILT);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_CLS_QUE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_CLS);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_CLS_FILT);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_QUE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSRC_DECODE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSINK_QUE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSINK_CLS);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_VIDEOSINK_SINK);
+
if (element_list) {
g_list_free(element_list);
element_list = NULL;
int channel = 0;
int a_enc = MM_AUDIO_CODEC_AMR;
int a_dev = MM_AUDIO_DEVICE_MIC;
- int UseNoiseSuppressor = 0;
double volume = 0.0;
char *err_name = NULL;
- char *audiosrc_name = NULL;
+ const char *audiosrc_name = NULL;
char *cat_name = NULL;
GstCaps *caps = NULL;
return err;
}
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_RECORD,
- "UseNoiseSuppressor",
- &UseNoiseSuppressor);
-
err = mm_camcorder_get_attributes(handle, &err_name,
MMCAM_AUDIO_DEVICE, &a_dev,
MMCAM_AUDIO_ENCODER, &a_enc,
}
/* Check existence */
- if (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst) {
- if (((GObject *)sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst)->ref_count > 0) {
- gst_object_unref(sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
+ if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst) {
+ if (((GObject *)sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst)->ref_count > 0) {
+ gst_object_unref(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
}
_mmcam_dbg_log("_MMCAMCORDER_AUDIOSRC_BIN is Already existed. Unref once...");
}
/* Create bin element */
- __ta__(" audiosource_bin",
- _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_AUDIOSRC_BIN, "audiosource_bin", err);
- );
+ _MMCAMCORDER_BIN_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN, "audiosource_bin", err);
if (a_dev == MM_AUDIO_DEVICE_MODEM) {
cat_name = strdup("AudiomodemsrcElement");
goto pipeline_creation_error;
}
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
cat_name,
&AudiosrcElement);
_mmcam_dbg_log("Audio src name : %s", audiosrc_name);
- __ta__(" audiosrc",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_SRC, audiosrc_name, NULL, element_list, err);
- );
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_SRC, audiosrc_name, "audiosrc_src", element_list, err);
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, AudiosrcElement);
+ _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, AudiosrcElement);
- __ta__(" audiosource_capsfilter",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_FILT, "capsfilter", NULL, element_list, err);
- );
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_FILT, "capsfilter", "audiosrc_capsfilter", element_list, err);
- if (a_enc != MM_AUDIO_CODEC_VORBIS) {
- __ta__(" audiosource_volume",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_VOL, "volume", NULL, element_list, err);
- );
- }
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_QUE, "queue", "audiosrc_queue", element_list, err);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_QUE].gst, "max-size-buffers", 0);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_QUE].gst, "max-size-bytes", 0);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_QUE].gst, "max-size-time", (int64_t)0);
- if (UseNoiseSuppressor && a_enc != MM_AUDIO_CODEC_AAC) {
- __ta__(" noise_suppressor",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_AUDIOSRC_NS, "noisesuppressor", "audiofilter", element_list, err);
- );
+ if (a_enc != MM_AUDIO_CODEC_VORBIS) {
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_VOL, "volume", "audiosrc_volume", element_list, err);
}
/* Set basic infomation */
if (volume == 0.0) {
/* Because data probe of audio src do the same job, it doesn't need to set "mute" here. Already null raw data. */
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", 1.0);
} else {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", volume);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "mute", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", volume);
}
if (format == MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE) {
depth = 16;
format_name = "S16LE";
} else { /* MM_CAMCORDER_AUDIO_FORMAT_PCM_U8 */
- format_name = "U8";
depth = 8;
+ format_name = "U8";
}
caps = gst_caps_new_simple("audio/x-raw",
- "rate", G_TYPE_INT, rate,
- "channels", G_TYPE_INT, channel,
- "format", G_TYPE_STRING, format_name,
- NULL);
- _mmcam_dbg_log("caps [x-raw-int,rate:%d,channel:%d,depth:%d]",
- rate, channel, depth);
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channel,
+ "format", G_TYPE_STRING, format_name,
+ NULL);
+ _mmcam_dbg_log("caps [x-raw, rate:%d, channel:%d, depth:%d], volume %lf",
+ rate, channel, depth, volume);
} else {
/* what are the audio encoder which should get audio/x-raw-float? */
caps = gst_caps_new_simple("audio/x-raw",
- "rate", G_TYPE_INT, rate,
- "channels", G_TYPE_INT, channel,
- "format", G_TYPE_STRING, GST_AUDIO_NE(F32),
- NULL);
- _mmcam_dbg_log("caps [x-raw-float,rate:%d,channel:%d,endianness:%d,width:32]",
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channel,
+ "format", G_TYPE_STRING, GST_AUDIO_NE(F32),
+ NULL);
+ _mmcam_dbg_log("caps [x-raw (F32), rate:%d, channel:%d, endianness:%d, width:32]",
rate, channel, BYTE_ORDER);
}
- MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_AUDIOSRC_FILT].gst), "caps", caps);
- gst_caps_unref(caps);
-
- if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst), element_list)) {
- _mmcam_dbg_err("element add error.");
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
- }
-
- if (!_mmcamcorder_link_elements(element_list)) {
- _mmcam_dbg_err( "element link error." );
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
- }
-
- last_element = (_MMCamcorderGstElement*)(g_list_last(element_list)->data);
- pad = gst_element_get_static_pad(last_element->gst, "src");
- if ((gst_element_add_pad( sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, gst_ghost_pad_new("src", pad) )) < 0) {
- gst_object_unref(pad);
- pad = NULL;
- _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_AUDIOSRC_BIN.");
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
- }
-
- gst_object_unref(pad);
- pad = NULL;
-
- if (element_list) {
- g_list_free(element_list);
- element_list = NULL;
- }
-
- return MM_ERROR_NONE;
-
-pipeline_creation_error:
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_SRC);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_FILT);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_VOL);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_QUE);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_CONV);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_ENC);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_AUDIOSRC_BIN);
- if (element_list) {
- g_list_free(element_list);
- element_list = NULL;
- }
-
- return err;
-}
-
-
-int _mmcamcorder_create_videosink_bin(MMHandleType handle)
-{
- int err = MM_ERROR_NONE;
- int rect_width = 0;
- int rect_height = 0;
- int camera_width = 0;
- int camera_height = 0;
- int rotate = 0;
- int flip = 0;
- int UseVideoscale = 0, EnableConvertedSC = 0;
- int scale_method = 0;
- char* videosink_name = NULL;
- char* videoscale_name = NULL;
- char* err_name = NULL;
-
- GstCaps *caps = NULL;
- GstPad *pad = NULL;
- GList *element_list = NULL;
-
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderSubContext *sc = NULL;
- _MMCamcorderGstElement *first_element = NULL;
- type_element *VideoscaleElement = NULL;
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-
- mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- _mmcam_dbg_log("START");
-
- /* Get attributes */
- err = mm_camcorder_get_attributes(handle, &err_name,
- MMCAM_CAMERA_WIDTH, &camera_width,
- MMCAM_CAMERA_HEIGHT, &camera_height,
- MMCAM_DISPLAY_RECT_WIDTH, &rect_width,
- MMCAM_DISPLAY_RECT_HEIGHT, &rect_height,
- MMCAM_DISPLAY_ROTATION, &rotate,
- MMCAM_DISPLAY_FLIP, &flip,
- "enable-converted-stream-callback", &EnableConvertedSC,
- NULL);
- if (err != MM_ERROR_NONE) {
- _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
- SAFE_FREE(err_name);
- return err;
- }
-
- /* Get videosink name */
- _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
-
- /* Check existence */
- if (sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst) {
- if (((GObject *)sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst)->ref_count > 0) {
- gst_object_unref(sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst);
- }
- _mmcam_dbg_log("_MMCAMCORDER_VIDEOSINK_BIN is Already existed. Unref once...");
- }
-
- /* Create bin element */
- __ta__(" videosink_bin",
- _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_VIDEOSINK_BIN, "videosink_bin", err);
- );
-
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
- "UseVideoscale",
- &UseVideoscale);
-
- /* Create child element */
- if (EnableConvertedSC ||
- !strcmp(videosink_name, "evasimagesink") ||
- !strcmp(videosink_name, "ximagesink")) {
- GstElementFactory *factory = gst_element_factory_find("fimcconvert");
-
- if ((strcmp(sc->format_name, "SN21") == 0 ||
- strcmp(sc->format_name, "SN12") == 0 ||
- strcmp(sc->format_name, "ST12") == 0 ||
- strcmp(sc->format_name, "S420") == 0) &&
- factory) {
- int set_rotate = 0;
- int set_flip = 0;
-
- gst_object_unref(factory);
- factory = NULL;
-
- __ta__(" videosink_fimcconvert",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_CLS, "fimcconvert", NULL, element_list, err);
- );
-
- /* set rotate */
- if (rotate > MM_VIDEO_INPUT_ROTATION_NONE &&
- rotate < MM_VIDEO_INPUT_ROTATION_NUM) {
- set_rotate = rotate * 90;
- } else {
- set_rotate = 0;
- }
-
- if (rect_width == 0 || rect_height == 0) {
- _mmcam_dbg_warn("rect_width or height is 0. set camera width and height.");
-
- if (rotate == MM_DISPLAY_ROTATION_90 ||
- rotate == MM_DISPLAY_ROTATION_270) {
- rect_width = camera_height;
- rect_height = camera_width;
- } else {
- rect_width = camera_width;
- rect_height = camera_height;
- }
- }
-
- /* set flip */
- switch (flip) {
- case MM_FLIP_HORIZONTAL:
- set_flip = FIMCCONVERT_FLIP_HORIZONTAL;
- break;
- case MM_FLIP_VERTICAL:
- set_flip = FIMCCONVERT_FLIP_VERTICAL;
- break;
- case MM_FLIP_BOTH: /* both flip has same effect with 180 rotation */
- set_rotate = (set_rotate + 180) % 360;
- case MM_FLIP_NONE:
- default:
- set_flip = FIMCCONVERT_FLIP_NONE;
- break;
- }
-
- _mmcam_dbg_log("Fimcconvert set values - %dx%d, rotate: %d, flip: %d",
- rect_width, rect_height, set_rotate, set_flip);
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "src-width", rect_width);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "src-height", rect_height);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "rotate", set_rotate);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_CLS].gst, "flip", set_flip);
- } else {
- if (factory) {
- gst_object_unref(factory);
- factory = NULL;
- }
-
- __ta__(" videosink_videoconvert",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_CLS, "videoconvert", NULL, element_list, err);
- );
- }
- } else if(UseVideoscale) {
- __ta__(" videosink_queue",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_QUE, "queue", NULL, element_list, err);
- );
-
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
- "VideoscaleElement",
- &VideoscaleElement);
- _mmcamcorder_conf_get_value_element_name(VideoscaleElement, &videoscale_name);
-
- __ta__(" videosink_videoscale",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_SCALE, videoscale_name, NULL, element_list, err);
- );
- __ta__(" videosink_capsfilter",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_FILT, "capsfilter", NULL, element_list, err);
- );
-
- _mmcamcorder_conf_get_value_element_int(VideoscaleElement, "method", &scale_method);
- _mmcam_dbg_log("VideoSINK Scale[%dx%d], Method[%d]", rect_width, rect_height, scale_method);
-
- if (rect_width == 0 || rect_height == 0) {
- _mmcam_dbg_warn("rect_width or height is 0. set camera width and height.");
-
- rect_width = camera_width;
- rect_height = camera_height;
- }
-
- caps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, rect_width,
- "height", G_TYPE_INT, rect_height,
- NULL);
- MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_VIDEOSINK_FILT].gst), "caps", caps);
- MMCAMCORDER_G_OBJECT_SET((sc->element[_MMCAMCORDER_VIDEOSINK_SCALE].gst), "method", scale_method);
+ if (caps) {
+ MMCAMCORDER_G_OBJECT_SET((sc->encode_element[_MMCAMCORDER_AUDIOSRC_FILT].gst), "caps", caps);
gst_caps_unref(caps);
caps = NULL;
+ } else {
+ _mmcam_dbg_err("create caps error");
+ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+ goto pipeline_creation_error;
}
- if (sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst == NULL) {
- __ta__(" videosink_queue",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_QUE, "queue", "videosink_queue", element_list, err);
- );
- }
-
- __ta__(" videosink",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_SINK, videosink_name, NULL, element_list, err);
- );
-
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink") ||
- !strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) {
- if (_mmcamcorder_videosink_window_set(handle, sc->VideosinkElement) != MM_ERROR_NONE) {
- _mmcam_dbg_err("_mmcamcorder_videosink_window_set error");
- err = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
- goto pipeline_creation_error;
- }
- }
-
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, sc->VideosinkElement);
-
- if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst), element_list)) {
+ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst), element_list)) {
_mmcam_dbg_err("element add error.");
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
goto pipeline_creation_error;
goto pipeline_creation_error;
}
- first_element = (_MMCamcorderGstElement*)(element_list->data);
- __ta__(" gst_element_get_static_pad",
- pad = gst_element_get_static_pad( first_element->gst, "sink");
- );
- if ((gst_element_add_pad( sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst, gst_ghost_pad_new("sink", pad) )) < 0) {
+ last_element = (_MMCamcorderGstElement*)(g_list_last(element_list)->data);
+ pad = gst_element_get_static_pad(last_element->gst, "src");
+ if ((gst_element_add_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, gst_ghost_pad_new("src", pad) )) < 0) {
gst_object_unref(pad);
pad = NULL;
- _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_VIDEOSINK_BIN.");
+ _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_AUDIOSRC_BIN.");
err = MM_ERROR_CAMCORDER_GST_LINK;
goto pipeline_creation_error;
}
element_list = NULL;
}
- _mmcam_dbg_log("END");
-
return MM_ERROR_NONE;
pipeline_creation_error:
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_QUE);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_SCALE);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_FILT);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_CLS);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_SINK);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSINK_BIN);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_SRC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_FILT);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_QUE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_VOL);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN);
+
if (element_list) {
g_list_free(element_list);
element_list = NULL;
int auto_audio_resample = 0;
int auto_color_space = 0;
char *gst_element_venc_name = NULL;
- char *gst_element_aenc_name = NULL;
- char *gst_element_ienc_name = NULL;
- char *gst_element_mux_name = NULL;
- char *gst_element_rsink_name = NULL;
- char *str_profile = NULL;
- char *str_aac = NULL;
- char *str_aar = NULL;
- char *str_acs = NULL;
+ const char *gst_element_aenc_name = NULL;
+ const char *gst_element_ienc_name = NULL;
+ const char *gst_element_mux_name = NULL;
+ const char *gst_element_rsink_name = NULL;
+ const char *str_profile = NULL;
+ const char *str_aac = NULL;
+ const char *str_aar = NULL;
+ const char *str_acs = NULL;
char *err_name = NULL;
- GstCaps *caps = NULL;
+ GstCaps *audio_caps = NULL;
+ GstCaps *video_caps = NULL;
GstPad *pad = NULL;
GList *element_list = NULL;
mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
+ _mmcam_dbg_log("start - profile : %d", profile);
/* Check existence */
- if (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst) {
- if (((GObject *)sc->element[_MMCAMCORDER_ENCSINK_BIN].gst)->ref_count > 0) {
- gst_object_unref(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst) {
+ if (((GObject *)sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst)->ref_count > 0) {
+ gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst);
}
_mmcam_dbg_log("_MMCAMCORDER_ENCSINK_BIN is Already existed.");
}
/* Create bin element */
- __ta__(" encodesink_bin",
- _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_ENCSINK_BIN, "encodesink_bin", err);
- );
+ _MMCAMCORDER_BIN_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_BIN, "encodesink_bin", err);
/* Create child element */
- __ta__(" encodebin",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_ENCBIN, "encodebin", NULL, element_list, err);
- );
+ if (profile != MM_CAMCORDER_ENCBIN_PROFILE_AUDIO) {
+ GstCaps *caps_from_pad = NULL;
+
+ /* create appsrc and capsfilter */
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SRC, "appsrc", "encodesink_src", element_list, err);
+
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_FILT, "capsfilter", "encodesink_filter", element_list, err);
+
+ /* release element_list, they will be placed out of encodesink bin */
+ if (element_list) {
+ g_list_free(element_list);
+ element_list = NULL;
+ }
+
+ /* set appsrc as live source */
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "is-live", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "format", 3); /* GST_FORMAT_TIME */
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "max-bytes", (int64_t)0); /* unlimited */
+
+ /* set capsfilter */
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ _mmcam_dbg_log("get pad from videosrc_filter");
+ pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src");
+ } else {
+ _mmcam_dbg_log("get pad from videosrc_que");
+ pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+ }
+ if (!pad) {
+ _mmcam_dbg_err("get videosrc_que src pad failed");
+ goto pipeline_creation_error;
+ }
+
+ caps_from_pad = gst_pad_get_allowed_caps(pad);
+ video_caps = gst_caps_copy(caps_from_pad);
+ gst_caps_unref(caps_from_pad);
+ caps_from_pad = NULL;
+ gst_object_unref(pad);
+ pad = NULL;
+
+ if (video_caps) {
+ char *caps_str = NULL;
+
+ gst_caps_set_simple(video_caps,
+ "width", G_TYPE_INT, sc->info_video->video_width,
+ "height", G_TYPE_INT, sc->info_video->video_height,
+ NULL);
+
+ caps_str = gst_caps_to_string(video_caps);
+ _mmcam_dbg_log("video caps [%s], set size %dx%d",
+ caps_str, sc->info_video->video_width, sc->info_video->video_height);
+ free(caps_str);
+ caps_str = NULL;
+
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "caps", video_caps);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "caps", video_caps);
+ } else {
+ _mmcam_dbg_err("create recording pipeline caps failed");
+ goto pipeline_creation_error;
+ }
+
+ /* connect signal for ready to push buffer */
+ MMCAMCORDER_SIGNAL_CONNECT(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst,
+ _MMCAMCORDER_HANDLER_VIDEOREC,
+ "need-data",
+ _mmcamcorder_ready_to_encode_callback,
+ hcamcorder);
+ }
+
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_ENCBIN, "encodebin", "encodesink_encbin", element_list, err);
/* check element availability */
mm_camcorder_get_attributes(handle, &err_name,
str_acs = "ImageAutoColorSpace";
}
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_profile, &encodebin_profile);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aac, &auto_audio_convert);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aar, &auto_audio_resample);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_acs, &auto_color_space);
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_profile, &encodebin_profile);
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aac, &auto_audio_convert);
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_aar, &auto_audio_resample);
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_RECORD, str_acs, &auto_color_space);
_mmcam_dbg_log("Profile:%d, AutoAudioConvert:%d, AutoAudioResample:%d, AutoColorSpace:%d",
encodebin_profile, auto_audio_convert, auto_audio_resample, auto_color_space);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "profile", encodebin_profile);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", auto_audio_convert);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-resample", auto_audio_resample);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", auto_color_space);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "use-video-toggle", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "profile", encodebin_profile);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", auto_audio_convert);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-resample", auto_audio_resample);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", auto_color_space);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "use-video-toggle", FALSE);
/* Codec */
if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
goto pipeline_creation_error;
}
- _mmcamcorder_conf_get_value_element_name(VideoencElement, &gst_element_venc_name);
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "venc-name", gst_element_venc_name);
- _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC, "video-encode", err);
-
- /* set color convert plugin */
- if (hcamcorder->use_zero_copy_format &&
- strcmp(sc->format_name,"SN12") != 0) {
- int dst_buffer_num = _MMCAMCORDER_CONVERT_OUTPUT_BUFFER_NUM;
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ gst_element_venc_name = strdup("capsfilter");
+ } else {
+ _mmcamcorder_conf_get_value_element_name(VideoencElement, (const char **)(&gst_element_venc_name));
+ }
- /* set fimcconvert as colorspace element */
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "vconv-name", "fimcconvert");
- _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VCONV, "video-convert", err);
+ if (gst_element_venc_name) {
+ _mmcam_dbg_log("video encoder name [%s]", gst_element_venc_name);
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, "SN12",
- NULL);
- if (caps) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "vcaps", caps);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_VCONV].gst, "dst-buffer-num", dst_buffer_num);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "venc-name", gst_element_venc_name);
+ _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC, "video-encode", err);
- gst_caps_unref (caps);
- caps = NULL;
- } else {
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_RECORD,
+ "UseVideoEncoderQueue",
+ &use_venc_queue);
+ if (use_venc_queue) {
+ _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC_QUE, "use-venc-queue", err);
}
- _mmcam_dbg_log("fimcconvert dst-buffer-num %d", dst_buffer_num);
- }
-
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_RECORD,
- "UseVideoEncoderQueue",
- &use_venc_queue);
- if (use_venc_queue) {
- _MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC_QUE, "use-venc-queue", err);
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ free(gst_element_venc_name);
+ gst_element_venc_name = NULL;
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "caps", video_caps);
+ }
+ } else {
+ _mmcam_dbg_err("Fail to get video encoder name");
+ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+ goto pipeline_creation_error;
}
}
if (sc->audio_disable == FALSE &&
profile != MM_CAMCORDER_ENCBIN_PROFILE_IMAGE) {
int use_aenc_queue =0;
- const gchar* int_formats = "{S8, U8, "
- "S16LE, S16BE, U16LE, U16BE, "
- "S24_32LE, S24_32BE, U24_32LE, U24_32BE, "
- "S32LE, S32BE, U32LE, U32BE, "
- "S24LE, S24BE, U24LE, U24BE, "
- "S20LE, S20BE, U20LE, U20BE, "
- "S18LE, S18BE, U18LE, U18BE}";
AudioencElement = _mmcamcorder_get_type_element(handle, MM_CAM_AUDIO_ENCODER);
if (!AudioencElement) {
_mmcamcorder_conf_get_value_element_name(AudioencElement, &gst_element_aenc_name);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "aenc-name", gst_element_aenc_name);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "aenc-name", gst_element_aenc_name);
_MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_AENC, "audio-encode", err);
if (audio_enc == MM_AUDIO_CODEC_AMR && channel == 2) {
- caps = gst_caps_new_simple("audio/x-raw",
+ audio_caps = gst_caps_new_simple("audio/x-raw",
"channels", G_TYPE_INT, 1,
- "format", G_TYPE_STRING, int_formats,
NULL);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", caps);
- gst_caps_unref (caps);
- caps = NULL;
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", audio_caps);
+ gst_caps_unref(audio_caps);
+ audio_caps = NULL;
}
if (audio_enc == MM_AUDIO_CODEC_OGG) {
- caps = gst_caps_new_simple("audio/x-raw", "format", G_TYPE_STRING, int_formats, NULL);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", caps);
- gst_caps_unref (caps);
- caps = NULL;
+ audio_caps = gst_caps_new_empty_simple("audio/x-raw");
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "acaps", audio_caps);
+ gst_caps_unref(audio_caps);
+ audio_caps = NULL;
_mmcam_dbg_log("***** MM_AUDIO_CODEC_OGG : setting audio/x-raw-int ");
}
- //AAC is marked as experimental,
- //so compliance level must be set accordingly
- if (audio_enc == MM_AUDIO_CODEC_AAC)
- {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "compliance", -2);
- }
-
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_RECORD,
"UseAudioEncoderQueue",
&use_aenc_queue);
if (use_aenc_queue) {
_MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_AENC_QUE, "use-aenc-queue", err);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-time",G_GUINT64_CONSTANT(0));
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-buffers",0);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-time", (int64_t)0);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst,"max-size-buffers", 0);
}
}
_mmcamcorder_conf_get_value_element_name(ImageencElement, &gst_element_ienc_name);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "ienc-name", gst_element_ienc_name);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "ienc-name", gst_element_ienc_name);
_MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_IENC, "image-encode", err);
}
_mmcamcorder_conf_get_value_element_name(MuxElement, &gst_element_mux_name);
- __ta__(" mux",
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "mux-name", gst_element_mux_name);
- );
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "mux-name", gst_element_mux_name);
_MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_MUX, "mux", err);
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, MuxElement);
+ _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, MuxElement);
}
/* Sink */
if (profile != MM_CAMCORDER_ENCBIN_PROFILE_IMAGE) {
/* for recording */
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_RECORD,
"RecordsinkElement",
&RecordsinkElement );
_mmcamcorder_conf_get_value_element_name(RecordsinkElement, &gst_element_rsink_name);
- __ta__(" Recordsink_sink",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_SINK, gst_element_rsink_name, NULL, element_list, err);
- );
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, gst_element_rsink_name, NULL, element_list, err);
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, RecordsinkElement);
+ _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, RecordsinkElement);
} else {
/* for stillshot */
- __ta__(" fakesink",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_ENCSINK_SINK, "fakesink", NULL, element_list, err);
- );
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, "fakesink", NULL, element_list, err);
}
if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
/* video encoder attribute setting */
if (v_bitrate > 0) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "bitrate", v_bitrate);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "bitrate", v_bitrate);
} else {
_mmcam_dbg_warn("video bitrate is too small[%d], so skip setting. Use DEFAULT value.", v_bitrate);
}
- /*MMCAMCORDER_G_OBJECT_SET ((sc->element[_MMCAMCORDER_ENCSINK_VENC].gst),"hw-accel", v_hw);*/
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, VideoencElement);
+ /*MMCAMCORDER_G_OBJECT_SET ((sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst),"hw-accel", v_hw);*/
+ _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, VideoencElement);
}
if (sc->audio_disable == FALSE &&
case MM_AUDIO_CODEC_AMR:
result = __mmcamcorder_get_amrnb_bitrate_mode(a_bitrate);
_mmcam_dbg_log("Set AMR encoder[%s] mode [%d]", gst_element_aenc_name, result);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "band-mode", result);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "band-mode", result);
break;
case MM_AUDIO_CODEC_AAC:
_mmcam_dbg_log("Set AAC encoder[%s] bitrate [%d]", gst_element_aenc_name, a_bitrate);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "bitrate", a_bitrate);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "bitrate", a_bitrate);
break;
default:
_mmcam_dbg_log("Audio codec is not AMR or AAC... you need to implement setting function for audio encoder bit-rate");
_mmcam_dbg_warn("Setting bitrate is too small, so skip setting. Use DEFAULT value.");
}
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, AudioencElement);
+ _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, AudioencElement);
}
_mmcam_dbg_log("Element creation complete");
/* Add element to bin */
- if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst), element_list)) {
+ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst), element_list)) {
_mmcam_dbg_err("element add error.");
err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
goto pipeline_creation_error;
_mmcam_dbg_log("Element add complete");
if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
- pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
- if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("video_sink0", pad)) < 0) {
+ pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
+ if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("video_sink0", pad)) < 0) {
gst_object_unref(pad);
pad = NULL;
_mmcam_dbg_err("failed to create ghost video_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
pad = NULL;
if (sc->audio_disable == FALSE) {
- pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
- if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
+ pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+ if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
gst_object_unref(pad);
pad = NULL;
_mmcam_dbg_err("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
pad = NULL;
}
} else if (profile == MM_CAMCORDER_ENCBIN_PROFILE_AUDIO) {
- pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
- if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
+ pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+ if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) {
gst_object_unref(pad);
pad = NULL;
_mmcam_dbg_err("failed to create ghost audio_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
pad = NULL;
} else {
/* for stillshot */
- pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
- if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("image_sink0", pad)) < 0) {
+ pad = gst_element_get_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
+ if (gst_element_add_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("image_sink0", pad)) < 0) {
gst_object_unref(pad);
pad = NULL;
_mmcam_dbg_err("failed to create ghost image_sink0 on _MMCAMCORDER_ENCSINK_BIN.");
element_list = NULL;
}
- return MM_ERROR_NONE;
-
-pipeline_creation_error :
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_ENCBIN);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_VENC);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_AENC);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_IENC);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_MUX);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_SINK);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_ENCSINK_BIN);
- if (element_list) {
- g_list_free(element_list);
- element_list = NULL;
+ if (video_caps) {
+ gst_caps_unref(video_caps);
+ video_caps = NULL;
}
- return err;
-}
-
+ _mmcam_dbg_log("done");
-int _mmcamcorder_create_stillshotsink_bin(MMHandleType handle)
-{
- int err = MM_ERROR_NONE;
- int capture_width = 0;
- int capture_height = 0;
- int UseCaptureMode = 0;
- char *gst_element_ienc_name = NULL;
- char *gst_element_videoscale_name = NULL;
-
- GList *element_list = NULL;
- GstPad *pad = NULL;
-
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderSubContext *sc = NULL;
- _MMCamcorderGstElement *first_element = NULL;
- type_element* ImageencElement = NULL;
- type_element* VideoscaleElement = NULL;
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- _mmcam_dbg_log("");
-
- /* Check existence */
- if (sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst) {
- if (((GObject *)sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst)->ref_count > 0) {
- gst_object_unref(sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst);
- }
- _mmcam_dbg_log("_MMCAMCORDER_STILLSHOTSINK_BIN is Already existed. Unref once...");
- }
-
- /* Check element availability */
- ImageencElement = _mmcamcorder_get_type_element(handle, MM_CAM_IMAGE_ENCODER);
- if (!ImageencElement) {
- _mmcam_dbg_err("Fail to get type element");
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
- }
-
- _mmcamcorder_conf_get_value_element_name(ImageencElement, &gst_element_ienc_name);
-
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_CAPTURE,
- "UseCaptureMode",
- &UseCaptureMode);
-
- /* Create bin element */
- __ta__(" stillshotsink_bin",
- _MMCAMCORDER_BIN_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_BIN, "stillshotsink_bin", err);
- );
-
- /* Create child element */
- __ta__(" stillshotsink_queue",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_QUE, "queue", NULL, element_list, err);
- );
- __ta__(" stillshotsink_toggle",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_TOGGLE, "toggle", NULL, element_list, err);
- );
-
- if (UseCaptureMode) {
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_CAPTURE,
- "VideoscaleElement",
- &VideoscaleElement);
- _mmcamcorder_conf_get_value_element_name(VideoscaleElement, &gst_element_videoscale_name);
-
- __ta__(" stillshotsink_videoscale",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_SCALE, "gst_element_videoscale_name", NULL, element_list, err);
- );
- __ta__(" stillshotsink_videocrop",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_CROP, "videocrop", NULL, element_list, err);
- );
- __ta__(" stillshotsink_capsfiltern",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_FILT, "capsfilter", NULL, element_list, err);
- );
- }
-
- __ta__(" image encoder",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_ENC, gst_element_ienc_name, NULL, element_list, err);
- );
-
- __ta__(" fakesink",
- _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_STILLSHOTSINK_SINK, "fakesink", NULL, element_list, err);
- );
-
- if (UseCaptureMode) {
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_STILLSHOTSINK_SCALE].gst, VideoscaleElement);
-
- /* Set property */
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAPTURE_WIDTH, &capture_width,
- MMCAM_CAPTURE_HEIGHT, &capture_height,
- NULL);
-
- __ta__(" _mmcamcorder_set_resize_property",
- err = _mmcamcorder_set_resize_property(handle, capture_width, capture_height);
- );
- if (err != MM_ERROR_NONE) {
- //unref??
- _mmcam_dbg_log("Set resize property failed.");
- goto pipeline_creation_error;
- }
- }
-
- if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst), element_list)) {
- _mmcam_dbg_err( "element add error." );
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
- }
-
- if (!_mmcamcorder_link_elements(element_list)) {
- _mmcam_dbg_err( "element link error." );
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
- }
-
- first_element = (_MMCamcorderGstElement*)(element_list->data);
+ return MM_ERROR_NONE;
- pad = gst_element_get_static_pad(first_element->gst, "sink");
- if (gst_element_add_pad( sc->element[_MMCAMCORDER_STILLSHOTSINK_BIN].gst, gst_ghost_pad_new("sink", pad)) < 0) {
- gst_object_unref(pad);
- pad = NULL;
- _mmcam_dbg_err("failed to create ghost pad on _MMCAMCORDER_STILLSHOTSINK_BIN.");
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
- }
- gst_object_unref(pad);
- pad = NULL;
+pipeline_creation_error :
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_ENCBIN);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_SRC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_FILT);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_VENC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_AENC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_IENC);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_MUX);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_SINK);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCSINK_BIN);
if (element_list) {
g_list_free(element_list);
element_list = NULL;
}
- return MM_ERROR_NONE;
-
-pipeline_creation_error :
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_QUE);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_TOGGLE);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_CROP);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_FILT);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_SCALE);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_ENC);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_SINK);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_STILLSHOTSINK_BIN);
- if (element_list) {
- g_list_free(element_list);
- element_list = NULL;
+ if (video_caps) {
+ gst_caps_unref(video_caps);
+ video_caps = NULL;
}
return err;
int err = MM_ERROR_NONE;
GstPad *srcpad = NULL;
- GstPad *sinkpad = NULL;
GstBus *bus = NULL;
mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
/** Create gstreamer element **/
/* Main pipeline */
- _MMCAMCORDER_PIPELINE_MAKE(sc, _MMCAMCORDER_MAIN_PIPE, "camcorder_pipeline", err);
+ _MMCAMCORDER_PIPELINE_MAKE(sc, sc->element, _MMCAMCORDER_MAIN_PIPE, "camera_pipeline", err);
/* Sub pipeline */
- __ta__(" __mmcamcorder_create_videosrc_bin",
- err = _mmcamcorder_create_videosrc_bin((MMHandleType)hcamcorder);
- );
- if (err != MM_ERROR_NONE ) {
+ err = _mmcamcorder_create_preview_elements((MMHandleType)hcamcorder);
+ if (err != MM_ERROR_NONE) {
goto pipeline_creation_error;
}
- __ta__(" _mmcamcorder_create_videosink_bin",
- err = _mmcamcorder_create_videosink_bin((MMHandleType)hcamcorder);
- );
- if (err != MM_ERROR_NONE ) {
+ /* Set data probe function */
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst) {
+ _mmcam_dbg_log("add video dataprobe to videosrc queue");
+ srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+ } else {
+ _mmcam_dbg_err("there is no queue plugin");
goto pipeline_creation_error;
}
- gst_bin_add_many(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst,
- sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst,
- NULL);
-
- /* Link each element */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src0");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_BIN].gst, "sink");
- _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+ if (srcpad) {
+ MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_PREVIEW,
+ __mmcamcorder_video_dataprobe_preview, hcamcorder);
+ gst_object_unref(srcpad);
+ srcpad = NULL;
+ } else {
+ _mmcam_dbg_err("failed to get srcpad");
+ goto pipeline_creation_error;
+ }
- /* Set data probe function */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+ /* set dataprobe for video recording */
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+ } else {
+ srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "src");
+ }
MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_PREVIEW,
- __mmcamcorder_video_dataprobe_preview, hcamcorder);
+ __mmcamcorder_video_dataprobe_push_buffer_to_record, hcamcorder);
gst_object_unref(srcpad);
srcpad = NULL;
bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
- /* Register message callback */
+ /* Register pipeline message callback */
hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, _mmcamcorder_pipeline_cb_message, (gpointer)hcamcorder);
/* set sync handler */
- gst_bus_set_sync_handler(bus, _mmcamcorder_pipeline_bus_sync_callback, (gpointer)hcamcorder, NULL);
+ gst_bus_set_sync_handler(bus, _mmcamcorder_pipeline_bus_sync_callback, (gpointer)hcamcorder, NULL);
gst_object_unref(bus);
bus = NULL;
return MM_ERROR_NONE;
pipeline_creation_error:
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_VIDEOSRC_BIN);
- _MMCAMCORDER_ELEMENT_REMOVE(sc, _MMCAMCORDER_MAIN_PIPE);
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_MAIN_PIPE);
return err;
}
info = sc->info_image;
if (info->resolution_change == TRUE) {
_mmcam_dbg_log("open toggle of stillshot sink.");
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
info->resolution_change = FALSE;
}
}
}
+void _mmcamcorder_ready_to_encode_callback(GstElement *element, guint size, gpointer handle)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = NULL;
+
+ /*_mmcam_dbg_log("start");*/
+
+ mmf_return_if_fail(hcamcorder);
+ mmf_return_if_fail(hcamcorder->sub_context);
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+
+ /* set flag */
+ if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_INIT) {
+ sc->info_video->get_first_I_frame = FALSE;
+ sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_RUN;
+ _mmcam_dbg_warn("set push_encoding_buffer RUN");
+ }
+}
+
+
int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* VideosinkElement)
{
int err = MM_ERROR_NONE;
int retheight = 0;
int visible = 0;
int rotation = MM_DISPLAY_ROTATION_NONE;
- int rotation_degree = 0;
int flip = MM_FLIP_NONE;
int display_mode = MM_DISPLAY_MODE_DEFAULT;
int display_geometry_method = MM_DISPLAY_METHOD_LETTER_BOX;
int origin_size = 0;
int zoom_attr = 0;
- float zoom_level = 0;
+ int zoom_level = 0;
int do_scaling = FALSE;
int *overlay = NULL;
gulong xid;
char *err_name = NULL;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
GstElement *vsink = NULL;
vsink = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
/* Get video display information */
- __ta__(" videosink get attributes",
err = mm_camcorder_get_attributes(handle, &err_name,
MMCAM_DISPLAY_RECT_X, &retx,
MMCAM_DISPLAY_RECT_Y, &rety,
MMCAM_DISPLAY_SCALE, &zoom_attr,
MMCAM_DISPLAY_EVAS_DO_SCALING, &do_scaling,
NULL);
- );
+ if (err != MM_ERROR_NONE) {
+ if (err_name) {
+ _mmcam_dbg_err("failed to get attributes [%s][0x%x]", err_name, err);
+ free(err_name);
+ err_name = NULL;
+ } else {
+ _mmcam_dbg_err("failed to get attributes [0x%x]", err);
+ }
- _mmcam_dbg_log("(overlay=%p, size=%d)", overlay, size);
+ return err;
+ }
_mmcamcorder_conf_get_value_element_name(VideosinkElement, &videosink_name);
+ _mmcam_dbg_log("(overlay=%p, size=%d)", overlay, size);
+
/* Set display handle */
if (!strcmp(videosink_name, "xvimagesink") ||
!strcmp(videosink_name, "ximagesink")) {
if (overlay) {
xid = *overlay;
_mmcam_dbg_log("xid = %lu )", xid);
- gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), xid);
+ gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), xid);
} else {
_mmcam_dbg_warn("Handle is NULL. Set xid as 0.. but, it's not recommended.");
- gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), 0);
+ gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), 0);
}
-
- _mmcam_dbg_log("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[enum:%d]",
- videosink_name, display_geometry_method, origin_size, visible, rotation);
} else if (!strcmp(videosink_name, "evasimagesink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
_mmcam_dbg_log("videosink : %s, handle : %p", videosink_name, overlay);
_mmcam_dbg_warn("Who are you?? (Videosink: %s)", videosink_name);
}
+ _mmcam_dbg_log("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[%d],flip[%d]",
+ videosink_name, display_geometry_method, origin_size, visible, rotation, flip);
+
/* Set attribute */
if (!strcmp(videosink_name, "xvimagesink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
+ /* set rotation */
+ MMCAMCORDER_G_OBJECT_SET(vsink, "rotate", rotation);
- if (!strcmp(videosink_name, "xvimagesink")) {
- /* set rotation */
- switch (rotation) {
- case MM_DISPLAY_ROTATION_NONE :
- rotation_degree = 0;
- break;
- case MM_DISPLAY_ROTATION_90 :
- rotation_degree = 1;
- break;
- case MM_DISPLAY_ROTATION_180 :
- rotation_degree = 2;
- break;
- case MM_DISPLAY_ROTATION_270 :
- rotation_degree = 3;
- break;
- default:
- _mmcam_dbg_warn("Unsupported rotation value. set as default(0).");
- rotation_degree = 0;
- break;
- }
- MMCAMCORDER_G_OBJECT_SET(vsink, "rotate", rotation_degree);
-
- /* set flip */
- MMCAMCORDER_G_OBJECT_SET(vsink, "flip", flip);
-
- _mmcam_dbg_log("set videosink[%s] rotate %d, flip %d",
- videosink_name, rotation_degree, flip);
- }
+ /* set flip */
+ MMCAMCORDER_G_OBJECT_SET(vsink, "flip", flip);
switch (zoom_attr) {
case MM_DISPLAY_SCALE_DEFAULT:
MMCAMCORDER_G_OBJECT_SET(vsink, "display-geometry-method", display_geometry_method);
MMCAMCORDER_G_OBJECT_SET(vsink, "display-mode", display_mode);
MMCAMCORDER_G_OBJECT_SET(vsink, "visible", visible);
- MMCAMCORDER_G_OBJECT_SET(vsink, "zoom", zoom_level);
+ MMCAMCORDER_G_OBJECT_SET(vsink, "zoom", (float)zoom_level);
if (display_geometry_method == MM_DISPLAY_METHOD_CUSTOM_ROI) {
g_object_set(vsink,
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
GstCameraControl *control = NULL;
- GstCameraControlExifInfo exif_info = {0,};
+ GstCameraControlExifInfo exif_info;
mmf_return_val_if_fail(hcamcorder, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ memset(&exif_info, 0x0, sizeof(GstCameraControlExifInfo));
+
if (sc && sc->element) {
int err = MM_ERROR_NONE;
char *err_name = NULL;
return TRUE;
}
-static guint32 _mmcamcorder_convert_fourcc_to_string(const gchar* format_name)
-{
+static guint32 _mmcamcorder_convert_fourcc_string_to_value(const gchar* format_name){
return format_name[0] | (format_name[1] << 8) | (format_name[2] << 16) | (format_name[3] << 24);
}
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
_MMCamcorderSubContext *sc = NULL;
_MMCamcorderKPIMeasure *kpi = NULL;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- GstMemory *dataBlock = NULL;
- GstMemory *metaBlock = NULL;
- GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstMemory *dataBlock = NULL;
+ GstMemory *metaBlock = NULL;
+ GstMapInfo mapinfo = GST_MAP_INFO_INIT;
- mmf_return_val_if_fail(buffer, FALSE);
- mmf_return_val_if_fail(gst_buffer_n_memory(buffer) , FALSE);
- mmf_return_val_if_fail(hcamcorder, TRUE);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(gst_buffer_n_memory(buffer) , GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
- mmf_return_val_if_fail(sc, TRUE);
+ mmf_return_val_if_fail(sc, GST_PAD_PROBE_DROP);
current_state = hcamcorder->state;
} else {
sc->drop_vframe--;
_mmcam_dbg_log("Drop video frame by drop_vframe");
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
} else if (sc->cam_stability_count > 0) {
sc->cam_stability_count--;
_mmcam_dbg_log("Drop video frame by cam_stability_count");
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
if (current_state >= MM_CAMCORDER_STATE_PREPARE) {
int state = MM_CAMCORDER_STATE_NULL;
unsigned int fourcc = 0;
MMCamcorderVideoStreamDataType stream;
+ SCMN_IMGB *scmn_imgb = NULL;
state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
if (state < MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_warn("Not ready for stream callback");
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
- caps = gst_pad_get_current_caps(pad);
+ caps = gst_pad_get_current_caps(pad);
if (caps == NULL) {
_mmcam_dbg_warn( "Caps is NULL." );
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
/* clear stream data structure */
structure = gst_caps_get_structure( caps, 0 );
gst_structure_get_int(structure, "width", &(stream.width));
gst_structure_get_int(structure, "height", &(stream.height));
- fourcc = _mmcamcorder_convert_fourcc_to_string(gst_structure_get_string(structure, "format"));
+ fourcc = _mmcamcorder_convert_fourcc_string_to_value(gst_structure_get_string(structure, "format"));
stream.format = _mmcamcorder_get_pixtype(fourcc);
gst_caps_unref( caps );
caps = NULL;
if (stream.width == 0 || stream.height == 0) {
_mmcam_dbg_warn("Wrong condition!!");
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
/* set size and timestamp */
dataBlock = gst_buffer_peek_memory(buffer, 0);
- stream.length_total = gst_memory_get_sizes(dataBlock, NULL, NULL);
- stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000); /* nano sec -> mili sec */
+ stream.length_total = gst_memory_get_sizes(dataBlock, NULL, NULL);
+ stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano sec -> mili sec */
- /* set data pointers */
- if (stream.format == MM_PIXEL_FORMAT_NV12 || stream.format == MM_PIXEL_FORMAT_I420) {
- if (hcamcorder->use_zero_copy_format && gst_buffer_n_memory(buffer) > 1) {
- metaBlock = gst_buffer_peek_memory(buffer, 1);
- gst_memory_map(metaBlock, &mapinfo, GST_MAP_READ);
- SCMN_IMGB *scmn_imgb = (SCMN_IMGB *)mapinfo.data;
+ if (hcamcorder->use_zero_copy_format && gst_buffer_n_memory(buffer) > 1) {
+ metaBlock = gst_buffer_peek_memory(buffer, 1);
+ gst_memory_map(metaBlock, &mapinfo, GST_MAP_READ);
+ scmn_imgb = (SCMN_IMGB *)mapinfo.data;
+ }
- if (stream.format == MM_PIXEL_FORMAT_NV12) {
+ /* set data pointers */
+ if (stream.format == MM_PIXEL_FORMAT_NV12 ||
+ stream.format == MM_PIXEL_FORMAT_NV21 ||
+ stream.format == MM_PIXEL_FORMAT_I420) {
+ if (scmn_imgb) {
+ if (stream.format == MM_PIXEL_FORMAT_NV12 ||
+ stream.format == MM_PIXEL_FORMAT_NV21) {
stream.data_type = MM_CAM_STREAM_DATA_YUV420SP;
stream.num_planes = 2;
stream.data.yuv420sp.y = scmn_imgb->a[0];
stream.data.yuv420sp.uv = scmn_imgb->a[1];
stream.data.yuv420sp.length_uv = stream.data.yuv420sp.length_y >> 1;
- _mmcam_dbg_log("SN12[num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
- stream.num_planes,
+ _mmcam_dbg_log("format[%d][num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
+ stream.format, stream.num_planes,
stream.data.yuv420sp.y, stream.data.yuv420sp.length_y,
stream.data.yuv420sp.uv, stream.data.yuv420sp.length_uv);
} else {
stream.data.yuv420p.v, stream.data.yuv420p.length_v);
}
} else {
- if (stream.format == MM_PIXEL_FORMAT_NV12) {
+ gst_memory_map(dataBlock, &mapinfo, GST_MAP_READWRITE);
+ if (stream.format == MM_PIXEL_FORMAT_NV12 ||
+ stream.format == MM_PIXEL_FORMAT_NV21) {
stream.data_type = MM_CAM_STREAM_DATA_YUV420SP;
stream.num_planes = 2;
- gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
- stream.data.yuv420sp.y = mapinfo.data;
+ stream.data.yuv420sp.y = mapinfo.data;
stream.data.yuv420sp.length_y = stream.width * stream.height;
stream.data.yuv420sp.uv = stream.data.yuv420sp.y + stream.data.yuv420sp.length_y;
stream.data.yuv420sp.length_uv = stream.data.yuv420sp.length_y >> 1;
- _mmcam_dbg_log("NV12[num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
- stream.num_planes,
+ _mmcam_dbg_log("format[%d][num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
+ stream.format, stream.num_planes,
stream.data.yuv420sp.y, stream.data.yuv420sp.length_y,
stream.data.yuv420sp.uv, stream.data.yuv420sp.length_uv);
} else {
stream.data_type = MM_CAM_STREAM_DATA_YUV420P;
stream.num_planes = 3;
- gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
- stream.data.yuv420p.y = mapinfo.data;
+ stream.data.yuv420p.y = mapinfo.data;
stream.data.yuv420p.length_y = stream.width * stream.height;
stream.data.yuv420p.u = stream.data.yuv420p.y + stream.data.yuv420p.length_y;
stream.data.yuv420p.length_u = stream.data.yuv420p.length_y >> 2;
}
}
} else {
+ if (scmn_imgb) {
+ gst_memory_unmap(metaBlock, &mapinfo);
+ metaBlock = NULL;
+ }
+ gst_memory_map(dataBlock, &mapinfo, GST_MAP_READWRITE);
if (stream.format == MM_PIXEL_FORMAT_YUYV ||
stream.format == MM_PIXEL_FORMAT_UYVY ||
stream.format == MM_PIXEL_FORMAT_422P ||
stream.format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
stream.data_type = MM_CAM_STREAM_DATA_YUV422;
- gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
- stream.data.yuv422.yuv = mapinfo.data;
+ stream.data.yuv422.yuv = mapinfo.data;
stream.data.yuv422.length_yuv = stream.length_total;
} else {
stream.data_type = MM_CAM_STREAM_DATA_YUV420;
- gst_memory_map(dataBlock, &mapinfo, GST_MAP_READ);
- stream.data.yuv420.yuv = mapinfo.data;
+ stream.data.yuv420.yuv = mapinfo.data;
stream.data.yuv420.length_yuv = stream.length_total;
}
hcamcorder->vstream_cb(&stream, hcamcorder->vstream_cb_param);
}
_MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(hcamcorder);
-
/* Either metaBlock was mapped, or dataBlock, but not both. */
if (metaBlock) {
- gst_memory_unmap(metaBlock, &mapinfo);
+ gst_memory_unmap(metaBlock, &mapinfo);
+ }else {
+ gst_memory_unmap(dataBlock, &mapinfo);
+ }
+ }
+
+ return GST_PAD_PROBE_OK;
+}
+
+static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
+ _MMCamcorderSubContext *sc = NULL;
+ GstClockTime diff = 0; /* nsec */
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(gst_buffer_n_memory(buffer), GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
+ mmf_return_val_if_fail(sc, GST_PAD_PROBE_DROP);
+
+ /* push buffer in appsrc to encode */
+ if(!sc->info_video) {
+ _mmcam_dbg_warn("sc->info_video is NULL!!");
+ return FALSE;
+ }
+
+ if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_RUN &&
+ sc->info_video->record_dual_stream == FALSE &&
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst) {
+ int ret = 0;
+ GstClock *clock = NULL;
+ GstPad *capsfilter_pad = NULL;
+
+ /*
+ _mmcam_dbg_log("GST_BUFFER_FLAG_DELTA_UNIT is set : %d",
+ GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT));
+ */
+
+ /* check first I frame */
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+ sc->info_video->get_first_I_frame == FALSE) {
+ if (!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
+ _mmcam_dbg_warn("first I frame is come");
+ sc->info_video->get_first_I_frame = TRUE;
+ } else {
+ _mmcam_dbg_warn("NOT I frame.. skip this buffer");
+ return GST_PAD_PROBE_OK;
+ }
+ }
+
+ if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+ if (sc->info_video->is_firstframe) {
+ sc->info_video->is_firstframe = FALSE;
+ clock = GST_ELEMENT_CLOCK(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst);
+ if (clock) {
+ gst_object_ref(clock);
+ sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer) - (gst_clock_get_time(clock) - GST_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst)->base_time);
+ gst_object_unref(clock);
+ }
+ }
} else {
- gst_memory_unmap(dataBlock, &mapinfo);
+ if(sc->info_video->is_firstframe) {
+ sc->info_video->is_firstframe = FALSE;
+ sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer);
+ }
}
+ GST_BUFFER_PTS(buffer) = GST_BUFFER_PTS(buffer) - sc->info_video->base_video_ts;
+ GST_BUFFER_DTS(buffer) = GST_BUFFER_PTS(buffer);
+
+ capsfilter_pad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+// gst_buffer_set_caps(buffer, GST_PAD_CAPS(capsfilter_pad));
+ gst_object_unref(capsfilter_pad);
+ capsfilter_pad = NULL;
+
+ _mmcam_dbg_log("buffer %p, timestamp %"GST_TIME_FORMAT, buffer, GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));
+ {
+ char *caps_string = gst_caps_to_string(gst_pad_get_current_caps(pad));
+ if (caps_string) {
+ _mmcam_dbg_log("%s", caps_string);
+ free(caps_string);
+ caps_string = NULL;
+ }
+ }
+
+ g_signal_emit_by_name(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "push-buffer", buffer, &ret);
+
+ /*_mmcam_dbg_log("push buffer result : 0x%x", ret);*/
}
- /* Do force flush cache */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "force-flush-cache", FALSE);
+ /* skip display if too fast FPS */
+ if (sc->info_video && sc->info_video->fps > _MMCAMCORDER_FRAME_PASS_MIN_FPS) {
+ if (sc->info_video->prev_preview_ts != 0) {
+ diff = GST_BUFFER_PTS(buffer) - sc->info_video->prev_preview_ts;
+ if (diff < _MMCAMCORDER_MIN_TIME_TO_PASS_FRAME) {
+ _mmcam_dbg_log("it's too fast. drop frame...");
+ return GST_PAD_PROBE_DROP;
+ }
+ }
+
+ /*_mmcam_dbg_log("diff %llu", diff);*/
+
+ sc->info_video->prev_preview_ts = GST_BUFFER_PTS(buffer);
}
- return GST_PAD_PROBE_OK;
+ //_mmcam_dbg_log("return TRUE");
+
+ return GST_PAD_PROBE_OK;
}
return result;
}
+
int _mmcamcorder_get_eos_message(MMHandleType handle)
{
- double elapsed = 0.0;
+ double elapsed = 0.0;
GstMessage *gMessage = NULL;
GstBus *bus = NULL;
GstClockTime timeout = 1 * GST_SECOND; /* maximum waiting time */
GTimer *timer = NULL;
+ int ret = MM_ERROR_NONE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
_mmcam_dbg_log("");
- bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
+ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
timer = g_timer_new();
if (sc && !(sc->bget_eos)) {
- while (1) {
- elapsed = g_timer_elapsed(timer, NULL);
+ while (TRUE) {
+ elapsed = g_timer_elapsed(timer, NULL);
/*_mmcam_dbg_log("elapsed:%f sec", elapsed);*/
if (elapsed > _MMCAMCORDER_WAIT_EOS_TIME) {
_mmcam_dbg_warn("Timeout. EOS isn't received.");
- g_timer_destroy(timer);
- gst_object_unref(bus);
- return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
+ ret = MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
+ break;
}
- gMessage = gst_bus_timed_pop (bus, timeout);
+ gMessage = gst_bus_timed_pop(bus, timeout);
if (gMessage != NULL) {
_mmcam_dbg_log("Get message(%x).", GST_MESSAGE_TYPE(gMessage));
+
+ if (GST_MESSAGE_TYPE(gMessage) == GST_MESSAGE_ERROR) {
+ GError *err;
+ gchar *debug;
+ gst_message_parse_error(gMessage, &err, &debug);
+
+ switch (err->code) {
+ case GST_RESOURCE_ERROR_WRITE:
+ _mmcam_dbg_err("File write error");
+ ret = MM_ERROR_FILE_WRITE;
+ break;
+ case GST_RESOURCE_ERROR_NO_SPACE_LEFT:
+ _mmcam_dbg_err("No left space");
+ ret = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
+ break;
+ case GST_RESOURCE_ERROR_OPEN_WRITE:
+ _mmcam_dbg_err("Out of storage");
+ ret = MM_ERROR_OUT_OF_STORAGE;
+ break;
+ case GST_RESOURCE_ERROR_SEEK:
+ _mmcam_dbg_err("File read(seek)");
+ ret = MM_ERROR_FILE_READ;
+ break;
+ default:
+ _mmcam_dbg_err("Resource error(%d)", err->code);
+ ret = MM_ERROR_CAMCORDER_GST_RESOURCE;
+ break;
+ }
+
+ g_error_free (err);
+ g_free (debug);
+
+ gst_message_unref(gMessage);
+ break;
+ }
+
_mmcamcorder_pipeline_cb_message(bus, gMessage, (void*)hcamcorder);
if (GST_MESSAGE_TYPE(gMessage) == GST_MESSAGE_EOS || sc->bget_eos) {
}
}
- g_timer_destroy(timer);
- gst_object_unref(bus);
+ g_timer_destroy(timer);
+ timer = NULL;
+ gst_object_unref(bus);
+ bus = NULL;
_mmcam_dbg_log("END");
- return MM_ERROR_NONE;
+ return ret;
}
-void _mmcamcorder_remove_element_handle(MMHandleType handle, int first_elem, int last_elem)
+void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int first_elem, int last_elem)
{
int i = 0;
- _MMCamcorderSubContext *sc = NULL;
-
- mmf_return_if_fail(handle);
+ _MMCamcorderGstElement *remove_element = (_MMCamcorderGstElement *)element;
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_if_fail(sc);
- mmf_return_if_fail(sc->element);
- mmf_return_if_fail((first_elem > 0) && (last_elem > 0) && (last_elem > first_elem));
+ mmf_return_if_fail(handle && remove_element);
+ mmf_return_if_fail((first_elem >= 0) && (last_elem > 0) && (last_elem > first_elem));
_mmcam_dbg_log("");
for (i = first_elem ; i <= last_elem ; i++) {
- sc->element[i].gst = NULL;
- sc->element[i].id = _MMCAMCORDER_NONE;
+ remove_element[i].gst = NULL;
+ remove_element[i].id = _MMCAMCORDER_NONE;
}
return;
bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate)
{
- char* videosink_name = NULL;
+ const char* videosink_name = NULL;
mmf_camcorder_t *hcamcorder = NULL;
_MMCamcorderSubContext *sc = NULL;
if (sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst) {
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
- if (!strcmp(videosink_name, "xvimagesink")) {
+ if (!strcmp(videosink_name, "xvimagesink") ||
+ !strcmp(videosink_name, "evaspixmapsink")) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
"rotate", display_rotate);
_mmcam_dbg_log("Set display-rotate [%d] done.", display_rotate);
bool _mmcamcorder_set_display_flip(MMHandleType handle, int display_flip)
{
- char* videosink_name = NULL;
+ const char* videosink_name = NULL;
mmf_camcorder_t *hcamcorder = NULL;
_MMCamcorderSubContext *sc = NULL;
if (sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst) {
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
- if (!strcmp(videosink_name, "xvimagesink")) {
+ if (!strcmp(videosink_name, "xvimagesink") ||
+ !strcmp(videosink_name, "evaspixmapsink")) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst,
"flip", display_flip);
_mmcam_dbg_log("Set display flip [%d] done.", display_flip);
{
int width = 0;
int height = 0;
+ int fps = 0;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_camcorder_t *hcamcorder = NULL;
+
+ hcamcorder = MMF_CAMCORDER(handle);
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc) {
+ _mmcam_dbg_log("sub context is not initailized");
+ return TRUE;
+ }
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_WIDTH, &width,
+ MMCAM_CAMERA_HEIGHT, &height,
+ MMCAM_CAMERA_FPS, &fps,
+ NULL);
+
+ _mmcam_dbg_log("set rotate %d", videosrc_rotate);
+
+ return _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, videosrc_rotate);
+}
+
+
+bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, int width, int height, int fps, int rotate)
+{
int set_width = 0;
int set_height = 0;
int set_rotate = 0;
- int fps = 0;
+ int fps_auto = 0;
+ unsigned int caps_fourcc = 0;
gboolean do_set_caps = FALSE;
GstCaps *caps = NULL;
- type_int_array *input_index = NULL;
mmf_camcorder_t *hcamcorder = NULL;
_MMCamcorderSubContext *sc = NULL;
hcamcorder = MMF_CAMCORDER(handle);
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ mmf_return_val_if_fail(hcamcorder, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ if (!sc || !(sc->element)) {
+ _mmcam_dbg_log("sub context is not initialized");
+ return TRUE;
+ }
if (!sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
_mmcam_dbg_err("Video src is NULL!");
return FALSE;
}
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_WIDTH, &width,
- MMCAM_CAMERA_HEIGHT, &height,
- MMCAM_CAMERA_FPS, &fps,
- NULL);
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ int capture_width = 0;
+ int capture_height = 0;
+ double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
- _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl,
- CONFIGURE_CATEGORY_CTRL_CAMERA,
- "InputIndex",
- &input_index );
- if (input_index == NULL) {
- _mmcam_dbg_err("Failed to get input_index");
- return FALSE;
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
+ MMCAM_CAMERA_FPS_AUTO, &fps_auto,
+ MMCAM_CAPTURE_WIDTH, &capture_width,
+ MMCAM_CAPTURE_HEIGHT, &capture_height,
+ MMCAM_VIDEO_WIDTH, &sc->info_video->video_width,
+ MMCAM_VIDEO_HEIGHT, &sc->info_video->video_height,
+ NULL);
+ _mmcam_dbg_log("motion rate %f, capture size %dx%d, fps auto %d, video size %dx%d",
+ motion_rate, capture_width, capture_height, fps_auto,
+ sc->info_video->video_width, sc->info_video->video_height);
+
+ if(motion_rate != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
+ } else {
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0);
+ }
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", capture_width);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", capture_height);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto);
+
+ /* set fps */
+ sc->info_video->fps = fps;
}
/* Interleaved format does not support rotation */
if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
/* store videosrc rotation */
- sc->videosrc_rotate = videosrc_rotate;
+ sc->videosrc_rotate = rotate;
/* Define width, height and rotate in caps */
/* This will be applied when rotate is 0, 90, 180, 270 if rear camera.
This will be applied when rotate is 0, 180 if front camera. */
- set_rotate = videosrc_rotate * 90;
+ set_rotate = rotate * 90;
- if (videosrc_rotate == MM_VIDEO_INPUT_ROTATION_90 ||
- videosrc_rotate == MM_VIDEO_INPUT_ROTATION_270) {
+ if (rotate == MM_VIDEO_INPUT_ROTATION_90 ||
+ rotate == MM_VIDEO_INPUT_ROTATION_270) {
set_width = height;
set_height = width;
- if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA1) {
- if (videosrc_rotate == MM_VIDEO_INPUT_ROTATION_90) {
+ if (hcamcorder->device_type == MM_VIDEO_DEVICE_CAMERA1) {
+ if (rotate == MM_VIDEO_INPUT_ROTATION_90) {
set_rotate = 270;
} else {
set_rotate = 90;
set_width = width;
set_height = height;
- _mmcam_dbg_warn("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]",
- videosrc_rotate);
- }
-
- /* correct size because ITLV does not support QCIF */
- if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA0 &&
- strcmp(sc->format_name, "ITLV") == 0) {
- if ((set_width == 176 && set_height == 144) ||
- (set_width == 144 && set_height == 176)) {
- set_width = set_width << 1;
- set_height = set_height << 1;
- _mmcam_dbg_log("ITLV format is not supported QCIF, so we set CIF(%dx%d)",
- set_width, set_height);
- }
+ _mmcam_dbg_warn("ITLV format doe snot support INPUT ROTATE. Ignore ROTATE[%d]", rotate);
}
MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", &caps);
- if (caps) {
+ if (caps && !gst_caps_is_any(caps)) {
GstStructure *structure = NULL;
structure = gst_caps_get_structure(caps, 0);
int caps_fps = 0;
int caps_rotate = 0;
+ caps_fourcc = _mmcamcorder_convert_fourcc_string_to_value(gst_structure_get_string(structure, "format"));
gst_structure_get_int(structure, "width", &caps_width);
gst_structure_get_int(structure, "height", &caps_height);
gst_structure_get_int(structure, "fps", &caps_fps);
gst_structure_get_int(structure, "rotate", &caps_rotate);
+
if (set_width == caps_width && set_height == caps_height &&
- set_rotate == caps_rotate && fps == caps_fps) {
+ fourcc == caps_fourcc && set_rotate == caps_rotate && fps == caps_fps) {
_mmcam_dbg_log("No need to replace caps.");
} else {
- _mmcam_dbg_log("something is different. set new one...");
+ _mmcam_dbg_log("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]",
+ caps_fourcc, caps_fourcc>>8, caps_fourcc>>16, caps_fourcc>>24,
+ caps_width, caps_height, caps_fps, caps_rotate,
+ fourcc, fourcc>>8, fourcc>>16, fourcc>>24,
+ set_width, set_height, fps, set_rotate);
do_set_caps = TRUE;
}
} else {
_mmcam_dbg_log("can not get structure of caps. set new one...");
do_set_caps = TRUE;
}
-
- gst_caps_unref(caps);
- caps = NULL;
} else {
_mmcam_dbg_log("No caps. set new one...");
do_set_caps = TRUE;
}
+ if (caps) {
+ gst_caps_unref(caps);
+ caps = NULL;
+ }
+
if (do_set_caps) {
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, sc->format_name,
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- "rotate", G_TYPE_INT, set_rotate,
- NULL);
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ caps = gst_caps_new_simple("video/x-h264",
+ "width", G_TYPE_INT, set_width,
+ "height", G_TYPE_INT, set_height,
+ "framerate", GST_TYPE_FRACTION, fps, 1,
+ "stream-format", G_TYPE_STRING, "byte-stream",
+ NULL);
+ } else {
+ char fourcc_string[sizeof(fourcc)+1];
+ strncpy(fourcc_string, (char*)&fourcc, sizeof(fourcc));
+ fourcc_string[sizeof(fourcc)] = '\0';
+ caps = gst_caps_new_simple("video/x-raw",
+ "format", G_TYPE_STRING, fourcc_string,
+ "width", G_TYPE_INT, set_width,
+ "height", G_TYPE_INT, set_height,
+ "framerate", GST_TYPE_FRACTION, fps, 1,
+ "rotate", G_TYPE_INT, set_rotate,
+ NULL);
+ }
+
+ _mmcam_dbg_log("vidoesrc new caps set. %"GST_PTR_FORMAT, caps);
+
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
gst_caps_unref(caps);
caps = NULL;
- _mmcam_dbg_log("vidoesrc new caps set. format[%s],width[%d],height[%d],fps[%d],rotate[%d]",
- sc->format_name, set_width, set_height, fps, set_rotate);
+ }
+
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ /* assume that it's camera capture mode */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "csc-range", 1);
}
return TRUE;
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
- type_int_array *input_index = NULL;
mmf_return_val_if_fail(hcamcorder, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
+ if (!sc) {
+ return TRUE;
+ }
_mmcam_dbg_log("Set FLIP %d", videosrc_flip);
/* Interleaved format does not support FLIP */
if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl,
- CONFIGURE_CATEGORY_CTRL_CAMERA,
- "InputIndex",
- &input_index );
-
hflip = (videosrc_flip & MM_FLIP_HORIZONTAL) == MM_FLIP_HORIZONTAL;
vflip = (videosrc_flip & MM_FLIP_VERTICAL) == MM_FLIP_VERTICAL;
mmf_return_val_if_fail(handle, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc, TRUE);
+ if (!sc) {
+ return TRUE;
+ }
v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst;
mmf_return_val_if_fail(sc, TRUE);
v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst;
-
if (!v_src) {
_mmcam_dbg_warn("videosrc element is NULL");
return FALSE;
/* check property of videosrc element - support VDIS */
if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(v_src)), "enable-vdis-mode")) {
- int camera_format =MM_PIXEL_FORMAT_INVALID;
- int camera_width = 0;
- int camera_height = 0;
+ int video_width = 0;
+ int video_height = 0;
if (stabilization == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
_mmcam_dbg_log("ENABLE video stabilization");
- /* VDIS mode only supports NV12 and [720p or 1080p] */
+ /* VDIS mode only supports NV12 and [720p or 1080p or 1088 * 1088] */
mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_FORMAT, &camera_format,
- MMCAM_CAMERA_WIDTH, &camera_width,
- MMCAM_CAMERA_HEIGHT, &camera_height,
+ MMCAM_VIDEO_WIDTH, &video_width,
+ MMCAM_VIDEO_HEIGHT, &video_height,
NULL);
- if (camera_format == MM_PIXEL_FORMAT_NV12 &&
- camera_width >= 1280 &&
- camera_height >= 720) {
- _mmcam_dbg_log("preview format %d, size %dx%d, ENABLE video stabilization",
- camera_format, camera_width, camera_height, stabilization);
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_NV12 &&
+ video_width >= 1080 && video_height >= 720) {
+ _mmcam_dbg_log("NV12, video size %dx%d, ENABLE video stabilization",
+ video_width, video_height, stabilization);
/* set vdis mode */
g_object_set(G_OBJECT(v_src),
"enable-vdis-mode", TRUE,
NULL);
} else {
- _mmcam_dbg_warn("invalid preview format %d or size %dx%d",
- camera_format, camera_width, camera_height);
+ _mmcam_dbg_warn("invalid preview format %c%c%c%c or video size %dx%d",
+ sc->fourcc, sc->fourcc>>8, sc->fourcc>>16, sc->fourcc>>24,
+ video_width, video_height);
return FALSE;
}
} else {
return TRUE;
}
+
+bool _mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height)
+{
+ int fps = 0;
+
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, FALSE);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc) {
+ return TRUE;
+ }
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_FPS, &fps,
+ NULL);
+
+ _mmcam_dbg_log("set %dx%d", width, height);
+
+ return _mmcamcorder_set_videosrc_caps(handle, sc->fourcc, width, height, fps, sc->videosrc_rotate);
+}
#include <gst/video/colorbalance.h>
#include <gst/video/cameracontrol.h>
-#include <asm/types.h>
-#include <mm_session.h>
-#include <mm_session_private.h>
-#include <audio-session-manager.h>
+#include <system_info.h>
/*---------------------------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS for internal |
| LOCAL VARIABLE DEFINITIONS for internal |
---------------------------------------------------------------------------------------*/
#define __MMCAMCORDER_CMD_ITERATE_MAX 3
-#define __MMCAMCORDER_SECURITY_HANDLE_DEFAULT -1
-#define __MMCAMCORDER_SET_GST_STATE_TIMEOUT 5
+#define __MMCAMCORDER_SET_GST_STATE_TIMEOUT 3
+#define __MMCAMCORDER_SOUND_WAIT_TIMEOUT 3
/*---------------------------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
static gint __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMessage *message , GError *error);
static gboolean __mmcamcorder_handle_gst_warning(MMHandleType handle, GstMessage *message, GError *error);
-static int __mmcamcorder_asm_get_event_type(int sessionType);
-static void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder);
-static void __mmcamcorder_force_resume(mmf_camcorder_t *hcamcorder);
-ASM_cb_result_t _mmcamcorder_asm_callback_sh(int handle, ASM_event_sources_t event_src,
- ASM_sound_commands_t command,
- unsigned int sound_status, void *cb_data);
-ASM_cb_result_t _mmcamcorder_asm_callback_ex(int handle, ASM_event_sources_t event_src,
- ASM_sound_commands_t command,
- unsigned int sound_status, void *cb_data);
#ifdef _MMCAMCORDER_USE_SET_ATTR_CB
static gboolean __mmcamcorder_set_attr_to_camsensor_cb(gpointer data);
{
int ret = MM_ERROR_NONE;
int UseConfCtrl = 0;
- int sessionType = MM_SESSION_TYPE_SHARE;
- int errorcode = MM_ERROR_NONE;
int rcmd_fmt_capture = MM_PIXEL_FORMAT_YUYV;
int rcmd_fmt_recording = MM_PIXEL_FORMAT_NV12;
int rcmd_dpy_rotation = MM_DISPLAY_ROTATION_270;
int camera_device_count = MM_VIDEO_DEVICE_NUM;
int camera_facing_direction = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR;
char *err_attr_name = NULL;
- char *ConfCtrlFile = NULL;
+ const char *ConfCtrlFile = NULL;
mmf_camcorder_t *hcamcorder = NULL;
- ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
type_element *EvasSurfaceElement = NULL;
_mmcam_dbg_log("Entered");
hcamcorder->state = MM_CAMCORDER_STATE_NONE;
hcamcorder->sub_context = NULL;
hcamcorder->target_state = MM_CAMCORDER_STATE_NULL;
+ hcamcorder->capture_in_recording = FALSE;
- /* thread - for g_mutex_new() */
- if (!g_thread_supported()) {
- g_thread_init(NULL);
- }
-
- (hcamcorder->mtsafe).lock = g_mutex_new();
- (hcamcorder->mtsafe).cond = g_cond_new();
+ pthread_mutex_init(&((hcamcorder->mtsafe).lock), NULL);
+ pthread_cond_init(&((hcamcorder->mtsafe).cond), NULL);
- (hcamcorder->mtsafe).cmd_lock = g_mutex_new();
- (hcamcorder->mtsafe).state_lock = g_mutex_new();
- (hcamcorder->mtsafe).gst_state_lock = g_mutex_new();
- (hcamcorder->mtsafe).message_cb_lock = g_mutex_new();
- (hcamcorder->mtsafe).vcapture_cb_lock = g_mutex_new();
- (hcamcorder->mtsafe).vstream_cb_lock = g_mutex_new();
- (hcamcorder->mtsafe).astream_cb_lock = g_mutex_new();
+ pthread_mutex_init(&((hcamcorder->mtsafe).cmd_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).asm_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).state_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).gst_state_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).gst_encode_state_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).message_cb_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).vcapture_cb_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).vstream_cb_lock), NULL);
+ pthread_mutex_init(&((hcamcorder->mtsafe).astream_cb_lock), NULL);
pthread_mutex_init(&(hcamcorder->sound_lock), NULL);
pthread_cond_init(&(hcamcorder->sound_cond), NULL);
+ pthread_mutex_init(&(hcamcorder->restart_preview_lock), NULL);
/* Sound mutex/cond init */
pthread_mutex_init(&(hcamcorder->snd_info.open_mutex), NULL);
pthread_cond_init(&(hcamcorder->snd_info.open_cond), NULL);
+ /* init for sound thread */
+ pthread_mutex_init(&(hcamcorder->task_thread_lock), NULL);
+ pthread_cond_init(&(hcamcorder->task_thread_cond), NULL);
+ hcamcorder->task_thread_state = _MMCAMCORDER_SOUND_STATE_NONE;
+
+ /* create task thread */
+ pthread_create(&(hcamcorder->task_thread), NULL, _mmcamcorder_util_task_thread_func, (void *)hcamcorder);
+
if (info->videodev_type < MM_VIDEO_DEVICE_NONE ||
info->videodev_type >= MM_VIDEO_DEVICE_NUM) {
_mmcam_dbg_err("_mmcamcorder_create::video device type is out of range.");
goto _ERR_DEFAULT_VALUE_INIT;
}
- /* Check and register ASM */
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
-
- /* Call will not be interrupted. so does not need callback function */
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- int pid = -1; /* process id of itself */
-
- /* set SHARE session */
- if (!ASM_register_sound(pid, &(hcamcorder->asm_handle_sh), ASM_EVENT_SHARE_MMCAMCORDER, ASM_STATE_NONE,
- (ASM_sound_cb_t)_mmcamcorder_asm_callback_sh,
- (void*)hcamcorder, mm_resource, &errorcode)) {
- _mmcam_dbg_err("SHARE ASM_register_sound() failed[%x]", errorcode);
- ret = MM_ERROR_POLICY_INTERNAL;
- goto _ERR_DEFAULT_VALUE_INIT;
- }
-
- /* set EXCLUSIVE session */
- if (!ASM_register_sound(pid, &(hcamcorder->asm_handle_ex), ASM_EVENT_EXCLUSIVE_MMCAMCORDER, ASM_STATE_NONE,
- (ASM_sound_cb_t)_mmcamcorder_asm_callback_ex,
- (void*)hcamcorder, mm_resource, &errorcode)) {
- _mmcam_dbg_err("EXCLUSIVE ASM_register_sound() failed[%x]", errorcode);
- ret = MM_ERROR_POLICY_INTERNAL;
- goto _ERR_DEFAULT_VALUE_INIT;
- }
-
- _mmcam_dbg_log("ASM handle - SHARE %d, EXCLUSIVE %d",
- hcamcorder->asm_handle_sh, hcamcorder->asm_handle_ex);
- }
+ /* set device type */
+ hcamcorder->device_type = info->videodev_type;
+ _mmcam_dbg_warn("Device Type : %d", hcamcorder->device_type);
/* Get Camera Configure information from Camcorder INI file */
- __ta__( " _mmcamcorder_conf_get_info main",
- _mmcamcorder_conf_get_info(CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &hcamcorder->conf_main);
- );
+ _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &hcamcorder->conf_main);
if (!(hcamcorder->conf_main)) {
_mmcam_dbg_err( "Failed to get configure(main) info." );
ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
- goto _ERR_AUDIO_BLOCKED;
+ goto _ERR_AFTER_ASM_REGISTER;
}
- __ta__(" _mmcamcorder_alloc_attribute",
hcamcorder->attributes = _mmcamcorder_alloc_attribute((MMHandleType)hcamcorder, info);
- );
if (!(hcamcorder->attributes)) {
_mmcam_dbg_err("_mmcamcorder_create::alloc attribute error.");
-
+
ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto _ERR_AUDIO_BLOCKED;
+ goto _ERR_AFTER_ASM_REGISTER;
}
if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"UseConfCtrl", &UseConfCtrl);
if (UseConfCtrl) {
_mmcam_dbg_log( "Enable Configure Control system." );
-#if 1
+
switch (info->videodev_type) {
case MM_VIDEO_DEVICE_CAMERA0:
- _mmcamcorder_conf_get_value_string(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_string((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"ConfCtrlFile0", &ConfCtrlFile);
break;
case MM_VIDEO_DEVICE_CAMERA1:
- _mmcamcorder_conf_get_value_string(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_string((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"ConfCtrlFile1", &ConfCtrlFile);
break;
default:
_mmcam_dbg_err( "Not supported camera type." );
ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
- goto _ERR_ALLOC_ATTRIBUTE;
+ goto _ERR_AFTER_ASM_REGISTER;
}
_mmcam_dbg_log("videodev_type : [%d], ConfCtrlPath : [%s]", info->videodev_type, ConfCtrlFile);
- __ta__( " _mmcamcorder_conf_get_info ctrl",
- _mmcamcorder_conf_get_info(CONFIGURE_TYPE_CTRL, ConfCtrlFile, &hcamcorder->conf_ctrl);
- );
+ _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_CTRL, ConfCtrlFile, &hcamcorder->conf_ctrl);
/*
_mmcamcorder_conf_print_info(&hcamcorder->conf_main);
_mmcamcorder_conf_print_info(&hcamcorder->conf_ctrl);
*/
-#else
- _mmcamcorder_conf_query_info(CONFIGURE_TYPE_CTRL, info->videodev_type, &hcamcorder->conf_ctrl);
-#endif
if (!(hcamcorder->conf_ctrl)) {
_mmcam_dbg_err( "Failed to get configure(control) info." );
ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
- goto _ERR_ALLOC_ATTRIBUTE;
+ goto _ERR_AFTER_ASM_REGISTER;
}
- __ta__( " _mmcamcorder_init_convert_table",
ret = _mmcamcorder_init_convert_table((MMHandleType)hcamcorder);
- );
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_warn("converting table initialize error!!");
}
- __ta__( " _mmcamcorder_init_attr_from_configure",
ret = _mmcamcorder_init_attr_from_configure((MMHandleType)hcamcorder);
- );
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_warn("converting table initialize error!!");
}
/* Get device info, recommend preview fmt and display rotation from INI */
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAMERA,
"RecommendPreviewFormatCapture",
&rcmd_fmt_capture);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAMERA,
"RecommendPreviewFormatRecord",
&rcmd_fmt_recording);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAMERA,
"RecommendDisplayRotation",
&rcmd_dpy_rotation);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_CAPTURE,
"PlayCaptureSound",
&play_capture_sound);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"DeviceCount",
&camera_device_count);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAMERA,
"FacingDirection",
&camera_facing_direction);
- _mmcam_dbg_log("Recommend fmt[cap:%d,rec:%d], dpy rot[%d], cap snd[%d], dev cnt[%d], cam facing dir[%d]",
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
+ CONFIGURE_CATEGORY_CTRL_EFFECT,
+ "BrightnessStepDenominator",
+ &hcamcorder->brightness_step_denominator);
+
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
+ CONFIGURE_CATEGORY_CTRL_CAPTURE,
+ "SupportZSL",
+ &hcamcorder->support_zsl_capture);
+
+ _mmcam_dbg_log("Recommend fmt[cap:%d,rec:%d], dpy rot %d, cap snd %d, dev cnt %d, cam facing dir %d, step denom %d, support zsl %d",
rcmd_fmt_capture, rcmd_fmt_recording, rcmd_dpy_rotation,
- play_capture_sound, camera_device_count, camera_facing_direction);
+ play_capture_sound, camera_device_count, camera_facing_direction,
+ hcamcorder->brightness_step_denominator, hcamcorder->support_zsl_capture);
+
+ /* Get UseZeroCopyFormat value from INI */
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ "UseZeroCopyFormat",
+ &(hcamcorder->use_zero_copy_format));
+
+ /* Get SupportMediaPacketPreviewCb value from INI */
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ "SupportMediaPacketPreviewCb",
+ &(hcamcorder->support_media_packet_preview_cb));
+
+ _mmcam_dbg_log("UseZeroCopyFormat : %d", hcamcorder->use_zero_copy_format);
+ _mmcam_dbg_log("SupportMediaPacketPreviewCb : %d", hcamcorder->support_media_packet_preview_cb);
mm_camcorder_set_attributes((MMHandleType)hcamcorder, &err_attr_name,
MMCAM_CAMERA_DEVICE_COUNT, camera_device_count,
MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, rcmd_fmt_capture,
MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, rcmd_fmt_recording,
MMCAM_RECOMMEND_DISPLAY_ROTATION, rcmd_dpy_rotation,
+ 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,
"capture-sound-enable", play_capture_sound,
NULL);
if (err_attr_name) {
err_attr_name = NULL;
}
- /* Get UseZeroCopyFormat value from INI */
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "UseZeroCopyFormat",
- &(hcamcorder->use_zero_copy_format));
- _mmcam_dbg_log("UseZeroCopyFormat : %d", hcamcorder->use_zero_copy_format);
- }
- else
- {
+ /* Get default value of brightness */
+ mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_attr_name,
+ MMCAM_FILTER_BRIGHTNESS, &hcamcorder->brightness_default,
+ NULL);
+ if (err_attr_name) {
+ _mmcam_dbg_err("Get brightness FAILED.");
+ free(err_attr_name);
+ err_attr_name = NULL;
+ }
+ _mmcam_dbg_log("Default brightness : %d", hcamcorder->brightness_default);
+ } else {
_mmcam_dbg_log( "Disable Configure Control system." );
hcamcorder->conf_ctrl = NULL;
}
}
- __ta__( " __mmcamcorder_gstreamer_init",
ret = __mmcamcorder_gstreamer_init(hcamcorder->conf_main);
- );
if (!ret) {
_mmcam_dbg_err( "Failed to initialize gstreamer!!" );
ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
- goto _ERR_ALLOC_ATTRIBUTE;
+ goto _ERR_AFTER_ASM_REGISTER;
}
/* Make some attributes as read-only type */
- __ta__( " _mmcamcorder_lock_readonly_attributes",
_mmcamcorder_lock_readonly_attributes((MMHandleType)hcamcorder);
- );
/* Disable attributes in each model */
- __ta__( " _mmcamcorder_set_disabled_attributes",
_mmcamcorder_set_disabled_attributes((MMHandleType)hcamcorder);
- );
-
- /* Determine state change as sync or async */
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_GENERAL,
- "SyncStateChange",
- &hcamcorder->sync_state_change );
- if (!(hcamcorder->sync_state_change)) {
- _mmcamcorder_create_command_loop((MMHandleType)hcamcorder);
- }
/* Get videosink name for evas surface */
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
"VideosinkElementEvas",
&EvasSurfaceElement);
if (EvasSurfaceElement) {
int attr_index = 0;
- char *evassink_name = NULL;
+ const char *evassink_name = NULL;
mmf_attribute_t *item_evassink_name = NULL;
mmf_attrs_t *attrs = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(hcamcorder);
vconf_get_int(VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY, &hcamcorder->shutter_sound_policy);
_mmcam_dbg_log("current shutter sound policy : %d", hcamcorder->shutter_sound_policy);
+ /* get model name */
+ system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &hcamcorder->model_name);
+
+ /* get software version */
+ system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_STRING, &hcamcorder->software_version);
+
/* Set initial state */
_mmcamcorder_set_state((MMHandleType)hcamcorder, MM_CAMCORDER_STATE_NULL);
- _mmcam_dbg_log("_mmcamcorder_set_state");
+
+ _mmcam_dbg_log("created handle %p", hcamcorder);
*handle = (MMHandleType)hcamcorder;
return MM_ERROR_NONE;
-_ERR_ALLOC_ATTRIBUTE:
-_ERR_AUDIO_BLOCKED:
- /* unregister audio session manager */
- {
- errorcode = MM_ERROR_NONE;
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
-
- if((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- /* unregister SHARE session */
- if (!ASM_unregister_sound(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER, &errorcode)) {
- _mmcam_dbg_err("ASM_unregister_sound() SHARE failed(hdl:%p, stype:%d, err:%x)",
- (void*)hcamcorder->asm_handle_sh, sessionType, errorcode);
- }
- /* unregister EXCLUSIVE session */
- if (!ASM_unregister_sound(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER, &errorcode)) {
- _mmcam_dbg_err("ASM_unregister_sound() EXCLUSIVE failed(hdl:%p, stype:%d, err:%x)",
- (void*)hcamcorder->asm_handle_ex, sessionType, errorcode);
- }
- }
- }
+_ERR_AFTER_ASM_REGISTER:
_ERR_DEFAULT_VALUE_INIT:
- g_mutex_free ((hcamcorder->mtsafe).lock);
- g_cond_free ((hcamcorder->mtsafe).cond);
- g_mutex_free ((hcamcorder->mtsafe).cmd_lock);
- g_mutex_free ((hcamcorder->mtsafe).state_lock);
- g_mutex_free ((hcamcorder->mtsafe).gst_state_lock);
+ /* Release lock, cond */
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).lock));
+ pthread_cond_destroy(&((hcamcorder->mtsafe).cond));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).cmd_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).asm_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).state_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_state_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_encode_state_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).message_cb_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).vcapture_cb_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).vstream_cb_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).astream_cb_lock));
+
+ pthread_mutex_destroy(&(hcamcorder->sound_lock));
+ pthread_cond_destroy(&(hcamcorder->sound_cond));
+ pthread_mutex_destroy(&(hcamcorder->snd_info.open_mutex));
+ pthread_cond_destroy(&(hcamcorder->snd_info.open_cond));
+ pthread_mutex_destroy(&(hcamcorder->restart_preview_lock));
if (hcamcorder->conf_ctrl) {
- _mmcamcorder_conf_release_info( &hcamcorder->conf_ctrl );
+ _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_ctrl);
}
if (hcamcorder->conf_main) {
- _mmcamcorder_conf_release_info( &hcamcorder->conf_main );
+ _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_main);
+ }
+
+ if (hcamcorder->model_name) {
+ free(hcamcorder->model_name);
+ hcamcorder->model_name = NULL;
+ }
+
+ if (hcamcorder->software_version) {
+ free(hcamcorder->software_version);
+ hcamcorder->software_version = NULL;
}
+ /* Release handle */
+ memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
+ free(hcamcorder);
+
return ret;
}
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
int state_FROM = MM_CAMCORDER_STATE_NULL;
- int state_TO = MM_CAMCORDER_STATE_NONE;
- int sessionType = MM_SESSION_TYPE_SHARE;
- int errorcode = MM_ERROR_NONE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* Set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret < 0) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ /* set exit state for sound thread */
+ pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+ _mmcam_dbg_log("send signal for task thread exit");
+ hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_EXIT;
+ pthread_cond_signal(&(hcamcorder->task_thread_cond));
+ pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+
+ pthread_mutex_lock(&(hcamcorder->sound_lock));
+ while (hcamcorder->capture_sound_count > 0) {
+ struct timespec timeout;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ timeout.tv_sec = tv.tv_sec + __MMCAMCORDER_SOUND_WAIT_TIMEOUT;
+ timeout.tv_nsec = tv.tv_usec * 1000;
+
+ _mmcam_dbg_warn("capture_sound_count[%d] is not zero. wait signal...",
+ hcamcorder->capture_sound_count);
+
+ if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) {
+ _mmcam_dbg_warn("signal received. check again...");
+ } else {
+ hcamcorder->capture_sound_count = 0;
+ _mmcam_dbg_err("capture sound completion wait time out");
+ break;
+ }
}
+ pthread_mutex_unlock(&(hcamcorder->sound_lock));
/* Release SubContext and pipeline */
if (hcamcorder->sub_context) {
if (hcamcorder->sub_context->element) {
- __ta__(" _mmcamcorder_destroy_pipeline",
_mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
- );
}
_mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
/* Remove attributes */
if (hcamcorder->attributes) {
- _mmcamcorder_dealloc_attribute(hcamcorder->attributes);
+ _mmcamcorder_dealloc_attribute(handle, hcamcorder->attributes);
hcamcorder->attributes = 0;
}
}
- /* Remove command loop when async state change mode */
- if (!hcamcorder->sync_state_change) {
- _mmcamcorder_destroy_command_loop(handle);
- }
-
/* Release configure info */
if (hcamcorder->conf_ctrl) {
- _mmcamcorder_conf_release_info( &hcamcorder->conf_ctrl );
+ _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_ctrl);
}
if (hcamcorder->conf_main) {
- _mmcamcorder_conf_release_info( &hcamcorder->conf_main );
+ _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_main);
}
/* Remove messages which are not called yet */
_mmcamcroder_remove_message_all(handle);
- /* Unregister ASM */
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
+ /* release model_name */
+ if (hcamcorder->model_name) {
+ free(hcamcorder->model_name);
+ hcamcorder->model_name = NULL;
}
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- /* unregister SHARE session */
- if (!ASM_unregister_sound(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER, &errorcode)) {
- _mmcam_dbg_err("SHARE ASM_unregister_sound() failed(hdl:%p, err:%x)",
- (void*)hcamcorder->asm_handle_sh, errorcode);
- }
- /* unregister EXCLUSIVE session */
- if (!ASM_unregister_sound(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER, &errorcode)) {
- _mmcam_dbg_err("EXCLUSIVE ASM_unregister_sound() failed(hdl:%p, err:%x)",
- (void*)hcamcorder->asm_handle_ex, errorcode);
- }
+ if (hcamcorder->software_version) {
+ free(hcamcorder->software_version);
+ hcamcorder->software_version = NULL;
}
+ /* join task thread */
+ _mmcam_dbg_log("task thread join");
+ pthread_join(hcamcorder->task_thread, NULL);
+
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
/* Release lock, cond */
- if ((hcamcorder->mtsafe).lock) {
- g_mutex_free ((hcamcorder->mtsafe).lock);
- (hcamcorder->mtsafe).lock = NULL;
- }
- if ((hcamcorder->mtsafe).cond) {
- g_cond_free ((hcamcorder->mtsafe).cond);
- (hcamcorder->mtsafe).cond = NULL;
- }
- if ((hcamcorder->mtsafe).cmd_lock) {
- g_mutex_free ((hcamcorder->mtsafe).cmd_lock);
- (hcamcorder->mtsafe).cmd_lock = NULL;
- }
- if ((hcamcorder->mtsafe).state_lock) {
- g_mutex_free ((hcamcorder->mtsafe).state_lock);
- (hcamcorder->mtsafe).state_lock = NULL;
- }
- if ((hcamcorder->mtsafe).gst_state_lock) {
- g_mutex_free ((hcamcorder->mtsafe).gst_state_lock);
- (hcamcorder->mtsafe).gst_state_lock = NULL;
- }
- if ((hcamcorder->mtsafe).message_cb_lock) {
- g_mutex_free ((hcamcorder->mtsafe).message_cb_lock);
- (hcamcorder->mtsafe).message_cb_lock = NULL;
- }
- if ((hcamcorder->mtsafe).vcapture_cb_lock) {
- g_mutex_free ((hcamcorder->mtsafe).vcapture_cb_lock);
- (hcamcorder->mtsafe).vcapture_cb_lock = NULL;
- }
- if ((hcamcorder->mtsafe).vstream_cb_lock) {
- g_mutex_free ((hcamcorder->mtsafe).vstream_cb_lock);
- (hcamcorder->mtsafe).vstream_cb_lock = NULL;
- }
- if ((hcamcorder->mtsafe).astream_cb_lock) {
- g_mutex_free ((hcamcorder->mtsafe).astream_cb_lock);
- (hcamcorder->mtsafe).astream_cb_lock = NULL;
- }
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).lock));
+ pthread_cond_destroy(&((hcamcorder->mtsafe).cond));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).cmd_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).asm_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).state_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_state_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_encode_state_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).message_cb_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).vcapture_cb_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).vstream_cb_lock));
+ pthread_mutex_destroy(&((hcamcorder->mtsafe).astream_cb_lock));
pthread_mutex_destroy(&(hcamcorder->sound_lock));
pthread_cond_destroy(&(hcamcorder->sound_cond));
pthread_mutex_destroy(&(hcamcorder->snd_info.open_mutex));
pthread_cond_destroy(&(hcamcorder->snd_info.open_cond));
+ pthread_mutex_destroy(&(hcamcorder->restart_preview_lock));
+ pthread_mutex_destroy(&(hcamcorder->task_thread_lock));
+ pthread_cond_destroy(&(hcamcorder->task_thread_cond));
/* Release handle */
memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
int state = MM_CAMCORDER_STATE_NONE;
int state_FROM = MM_CAMCORDER_STATE_NULL;
int state_TO = MM_CAMCORDER_STATE_READY;
- int sessionType = MM_SESSION_TYPE_SHARE;
- int errorcode = MM_ERROR_NONE;
int display_surface_type = MM_DISPLAY_SURFACE_X;
double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
char *videosink_element_type = NULL;
- char *videosink_name = NULL;
+ const char *videosink_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
return ret;
}
- /* Check quick-device-close for emergency */
- if (hcamcorder->quick_device_close) {
- _mmcam_dbg_err("_mmcamcorder_realize can't be called!!!!");
- ret = MM_ERROR_CAMCORDER_DEVICE;
- goto _ERR_CAMCORDER_CMD_PRECON;
- }
-
if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
_mmcam_dbg_err("Another command is running.");
ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_MODE, &hcamcorder->type,
+ NULL);
+
+ /* Get profile mode */
+ _mmcam_dbg_log("Profile mode [%d]", hcamcorder->type);
+
/* set camera state to vconf key */
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
int vconf_camera_state = 0;
vconf_camera_state, VCONFKEY_CAMERA_STATE_OPEN);
}
- /* Set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret < 0) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
mm_camcorder_get_attributes(handle, NULL,
- MMCAM_MODE, &hcamcorder->type,
MMCAM_DISPLAY_SURFACE, &display_surface_type,
MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
NULL);
- /* Get profile mode */
- _mmcam_dbg_log("Profile mode set is (%d)", hcamcorder->type);
-
- /* Check and make SHARE session as PLAYING */
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
- switch (hcamcorder->type) {
- case MM_CAMCORDER_MODE_AUDIO:
- mm_resource = ASM_RESOURCE_NONE;
- break;
- case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
- default:
- mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
- break;
- }
-
- if (!ASM_set_sound_state(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER,
- ASM_STATE_PLAYING, mm_resource, &errorcode)) {
- _mmcam_dbg_err("Set state to playing failed 0x%x", errorcode);
- ret = MM_ERROR_POLICY_BLOCKED;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
- }
-
/* alloc sub context */
hcamcorder->sub_context = _mmcamcorder_alloc_subcontext(hcamcorder->type);
if(!hcamcorder->sub_context) {
ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
/* Set basic configure information */
hcamcorder->sub_context->is_modified_rate = TRUE;
}
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_CAPTURE,
"UseEncodebin",
&(hcamcorder->sub_context->bencbin_capture));
+ _mmcam_dbg_warn("UseEncodebin [%d]", hcamcorder->sub_context->bencbin_capture);
+
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ /* get dual stream support info */
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_RECORD,
+ "SupportDualStream",
+ &(hcamcorder->sub_context->info_video->support_dual_stream));
+ _mmcam_dbg_warn("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream);
+ }
switch (display_surface_type) {
case MM_DISPLAY_SURFACE_X:
/* check string of videosink element */
if (videosink_element_type) {
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
videosink_element_type,
&hcamcorder->sub_context->VideosinkElement);
_mmcam_dbg_warn("strdup failed(display_surface_type %d). Use default X type",
display_surface_type);
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
_MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE,
- &hcamcorder->sub_context->VideosinkElement );
+ &hcamcorder->sub_context->VideosinkElement);
}
_mmcamcorder_conf_get_value_element_name(hcamcorder->sub_context->VideosinkElement, &videosink_name);
_mmcam_dbg_log("Videosink name : %s", videosink_name);
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl,
+ /* get videoconvert element */
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
+ "VideoconvertElement",
+ &hcamcorder->sub_context->VideoconvertElement);
+
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAPTURE,
"SensorEncodedCapture",
&(hcamcorder->sub_context->SensorEncodedCapture));
_mmcam_dbg_log("Support sensor encoded capture : %d", hcamcorder->sub_context->SensorEncodedCapture);
/* create pipeline */
- __ta__(" _mmcamcorder_create_pipeline",
ret = _mmcamcorder_create_pipeline(handle, hcamcorder->type);
- );
if (ret != MM_ERROR_NONE) {
/* check internal error of gstreamer */
if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
/* release sub context */
_mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
hcamcorder->sub_context = NULL;
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
/* set command function */
_mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
_mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
hcamcorder->sub_context = NULL;
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
_mmcamcorder_set_state(handle, state_TO);
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
-
+
_ERR_CAMCORDER_CMD_PRECON:
_mmcam_dbg_err("Realize fail (type %d, state %d, ret %x)",
hcamcorder->type, state, ret);
int state = MM_CAMCORDER_STATE_NONE;
int state_FROM = MM_CAMCORDER_STATE_READY;
int state_TO = MM_CAMCORDER_STATE_NULL;
- int sessionType = MM_SESSION_TYPE_SHARE;
- ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
/* Release SubContext */
if (hcamcorder->sub_context) {
/* destroy pipeline */
/* check who calls unrealize. it's no need to set ASM state if caller is ASM */
if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
-
- /* Call session is not ended here */
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- mm_resource = ASM_RESOURCE_NONE;
-
- switch (hcamcorder->type) {
- case MM_CAMCORDER_MODE_AUDIO:
- mm_resource = ASM_RESOURCE_NONE;
- break;
- case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
- default:
- mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
- break;
- }
-
- /* STOP SHARE session */
- if (!ASM_set_sound_state(hcamcorder->asm_handle_sh, ASM_EVENT_SHARE_MMCAMCORDER,
- ASM_STATE_STOP, mm_resource, &ret)) {
- _mmcam_dbg_err("SHARE Set state to STOP failed 0x%x", ret);
- }
- }
+ /* TODO */
}
- _mmcamcorder_set_state(handle, state_TO);
-
/* set camera state to vconf key */
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
int vconf_camera_state = 0;
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
+ _mmcamcorder_set_state(handle, state_TO);
+
return MM_ERROR_NONE;
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- /* check quick-device-close for emergency */
- if (hcamcorder->quick_device_close) {
- _mmcam_dbg_err("_mmcamcorder_start can't be called!!!!");
- ret = MM_ERROR_CAMCORDER_DEVICE;
- goto _ERR_CAMCORDER_CMD_PRECON;
- }
-
if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
_mmcam_dbg_err("Another command is running.");
ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
/* initialize error code */
hcamcorder->sub_context->error_code = MM_ERROR_NONE;
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ /* set attributes related sensor */
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ _mmcamcorder_set_attribute_to_camsensor(handle);
}
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_START);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ /* check internal error of gstreamer */
+ if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+ ret = hcamcorder->sub_context->error_code;
+ _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret);
+ }
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
_mmcamcorder_set_state(handle, state_TO);
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
int vconf_camera_state = 0;
- _mmcamcorder_set_attribute_to_camsensor(handle);
-
/* check camera state of vconf key */
vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state);
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
_ERR_CAMCORDER_CMD_PRECON:
/* check internal error of gstreamer */
- if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+ if (hcamcorder->sub_context &&
+ hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
ret = hcamcorder->sub_context->error_code;
hcamcorder->sub_context->error_code = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
int state_FROM = MM_CAMCORDER_STATE_PREPARE;
int state_TO = MM_CAMCORDER_STATE_READY;
- int frame_rate = 0;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_STOP);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* KPI : frame rate */
- frame_rate=_mmcamcorder_video_average_framerate(handle);
- __ta__(__tafmt__("MM_CAM_006:: Frame per sec : %d", frame_rate), ;);
-
_mmcamcorder_set_state(handle, state_TO);
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
int state_FROM_1 = MM_CAMCORDER_STATE_RECORDING;
int state_FROM_2 = MM_CAMCORDER_STATE_PAUSED;
int state_TO = MM_CAMCORDER_STATE_CAPTURING;
- char *err_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ /* Handle capture in recording case */
+ if (state == state_FROM_1 || state == state_FROM_2) {
+ if (hcamcorder->capture_in_recording == TRUE) {
+ _mmcam_dbg_err("Capturing in recording (%d)", state);
+ ret = MM_ERROR_CAMCORDER_DEVICE_BUSY;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ } else {
+ hcamcorder->capture_in_recording = TRUE;
+ }
}
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_CAPTURE);
_mmcamcorder_set_state(handle, state_TO);
}
- /* Init break continuous shot attr */
- mm_camcorder_set_attributes(handle, &err_name, "capture-break-cont-shot", 0, NULL);
-
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
+ /* Init break continuous shot attr */
+ if (mm_camcorder_set_attributes(handle, NULL, "capture-break-cont-shot", 0, NULL) != MM_ERROR_NONE) {
+ _mmcam_dbg_warn("capture-break-cont-shot set 0 failed");
+ }
+
return MM_ERROR_NONE;
_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
+ if (hcamcorder->capture_in_recording) {
+ hcamcorder->capture_in_recording = FALSE;
+ }
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_START);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
_mmcamcorder_set_state(handle, state_TO);
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
- MMTA_ACUM_ITEM_END("Real First Capture Start", FALSE);
-
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
int state_FROM1 = MM_CAMCORDER_STATE_PREPARE;
int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
int state_TO = MM_CAMCORDER_STATE_RECORDING;
- int sessionType = MM_SESSION_TYPE_SHARE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
/* initialize error code */
hcamcorder->sub_context->error_code = MM_ERROR_NONE;
- /* Check and register EXCLUSIVE ASM */
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- int errorcode;
- ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
- switch (hcamcorder->type) {
- case MM_CAMCORDER_MODE_AUDIO:
- mm_resource = ASM_RESOURCE_NONE;
- break;
- case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
- default:
- mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
- break;
- }
-
- if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
- ASM_STATE_PLAYING, mm_resource, &errorcode)) {
- _mmcam_dbg_err("Set state to playing failed 0x%x", errorcode);
- ret = MM_ERROR_POLICY_BLOCKED;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
- }
-
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_RECORD);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ /* check internal error of gstreamer */
+ if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+ ret = hcamcorder->sub_context->error_code;
+ _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret);
+ }
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
_mmcamcorder_set_state(handle, state_TO);
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
_ERR_CAMCORDER_CMD_PRECON:
/* check internal error of gstreamer */
- if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
+ if (hcamcorder->sub_context &&
+ hcamcorder->sub_context->error_code != MM_ERROR_NONE) {
ret = hcamcorder->sub_context->error_code;
hcamcorder->sub_context->error_code = MM_ERROR_NONE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PAUSE);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
_mmcamcorder_set_state(handle, state_TO);
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
int state_TO = MM_CAMCORDER_STATE_PREPARE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
+
_mmcam_dbg_log("");
if (!hcamcorder) {
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_COMMIT);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- _mmcamcorder_set_state(handle,state_TO);
-
/* set camera state to vconf key */
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
int vconf_camera_state = 0;
/* check who calls unrealize. it's no need to set ASM state if caller is ASM */
if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
- int sessionType = MM_SESSION_TYPE_SHARE;
- ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
-
- /* Call session is not ended here */
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- switch (hcamcorder->type) {
- case MM_CAMCORDER_MODE_AUDIO:
- mm_resource = ASM_RESOURCE_NONE;
- break;
- case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
- default:
- mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
- break;
- }
-
- /* STOP EXCLUSIVE session */
- if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
- ASM_STATE_STOP, mm_resource, &ret)) {
- _mmcam_dbg_err("EXCLUSIVE Set state to STOP failed 0x%x", ret);
- }
- }
+ /* TODO */
}
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
- return MM_ERROR_NONE;
+ _mmcamcorder_set_state(handle,state_TO);
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
+ return MM_ERROR_NONE;
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
int state_FROM1 = MM_CAMCORDER_STATE_RECORDING;
int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
int state_TO = MM_CAMCORDER_STATE_PREPARE;
- int sessionType = MM_SESSION_TYPE_SHARE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
+
_mmcam_dbg_log("");
if (!hcamcorder) {
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- /* set async state */
- ret = _mmcamcorder_set_async_state(handle, state_TO);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Can't set async state");
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_CANCEL);
if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
_mmcamcorder_set_state(handle, state_TO);
- /* read session type */
- if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) {
- _mmcam_dbg_log("_mm_session_util_read_type Fail. but keep going...");
- sessionType = MM_SESSION_TYPE_SHARE;
- }
-
- /* Call session is not ended here */
- if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) {
- ASM_resource_t mm_resource = ASM_RESOURCE_NONE;
-
- switch (hcamcorder->type) {
- case MM_CAMCORDER_MODE_AUDIO:
- mm_resource = ASM_RESOURCE_NONE;
- break;
- case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
- default:
- mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
- break;
- }
-
- /* STOP EXCLUSIVE session */
- if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
- ASM_STATE_STOP, mm_resource, &ret)) {
- _mmcam_dbg_err("EXCLUSIVE Set state to STOP failed 0x%x", ret);
- }
- }
-
- /* set camera state to vconf key */
- if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
- int vconf_camera_state = 0;
+ /* set camera state to vconf key */
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ int vconf_camera_state = 0;
/* get current camera state of vconf key */
vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state);
return MM_ERROR_NONE;
-_ERR_CAMCORDER_CMD:
- /* set async state and (set async cancel or set state) are pair. */
- _mmcamcorder_set_async_cancel(handle);
-
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
int current_af_range = 0;
mmf_camcorder_t *hcamcorder = NULL;
_MMCamcorderSubContext *sc = NULL;
- mmf_attrs_t *attr = NULL;
GstCameraControl *control = NULL;
_mmcam_dbg_log("");
}
/* Initialize lens position */
- attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
mm_camcorder_get_attributes(handle, NULL,
MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
MMCAM_CAMERA_AF_SCAN_RANGE, &af_range,
_mmcam_dbg_log("");
+ if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) {
+ _mmcam_dbg_err("Another command is running.");
+ return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
+ }
+
state = _mmcamcorder_get_state(handle);
if (state == MM_CAMCORDER_STATE_CAPTURING ||
state < MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_err("Not proper state. state[%d]", state);
+ _MMCAMCORDER_UNLOCK_CMD(handle);
return MM_ERROR_CAMCORDER_INVALID_STATE;
}
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_warn("Get focus-mode fail. (%s:%x)", err_attr_name, ret);
SAFE_FREE (err_attr_name);
+ _MMCAMCORDER_UNLOCK_CMD(handle);
return ret;
}
if (focus_mode == MM_CAMCORDER_FOCUS_MODE_MANUAL) {
- return _mmcamcorder_adjust_manual_focus(handle, direction);
+ ret = _mmcamcorder_adjust_manual_focus(handle, direction);
} else if (focus_mode == MM_CAMCORDER_FOCUS_MODE_AUTO ||
focus_mode == MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO ||
focus_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS) {
- return _mmcamcorder_adjust_auto_focus(handle);
+ ret = _mmcamcorder_adjust_auto_focus(handle);
} else {
_mmcam_dbg_err("It doesn't adjust focus. Focusing mode(%d)", focus_mode);
- return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ ret = MM_ERROR_CAMCORDER_NOT_SUPPORTED;
}
+
+ _MMCAMCORDER_UNLOCK_CMD(handle);
+
+ return ret;
}
int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction)
}
/* initializing gstreamer */
- __ta__(" gst_init_check",
ret = gst_init_check (argc, &argv, &err);
- );
-
if (!ret) {
_mmcam_dbg_err("Could not initialize GStreamer: %s ",
err ? err->message : "unknown error occurred");
switch (hcamcorder->state_change_by_system) {
case _MMCAMCORDER_STATE_CHANGE_BY_ASM:
msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM;
- msg.param.state.code = hcamcorder->asm_event_code;
break;
case _MMCAMCORDER_STATE_CHANGE_NORMAL:
default:
return state;
}
-int _mmcamcorder_set_async_state(MMHandleType handle, int target_state)
-{
- int error = MM_ERROR_NONE;
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
- _mmcam_dbg_log("");
-
- if (hcamcorder->sync_state_change) {
- return error;
- }
-
- _MMCAMCORDER_LOCK_STATE(handle);
-
- /* check changing state */
- if (hcamcorder->state != hcamcorder->target_state) {
- _mmcam_dbg_warn("State is changing now.");
- error = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
- goto _SET_ASYNC_END;
- }
-
- /* check already set */
- if (hcamcorder->state == target_state) {
- _mmcam_dbg_log("Target state already set.");
- error = MM_ERROR_CAMCORDER_INVALID_STATE;
- goto _SET_ASYNC_END;
- }
-
- hcamcorder->target_state = target_state;
-
- _mmcam_dbg_log("Done");
-
-_SET_ASYNC_END:
- _MMCAMCORDER_UNLOCK_STATE(handle);
- return error;
-}
-
-
-gboolean _mmcamcorder_set_async_cancel(MMHandleType handle)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
- mmf_return_val_if_fail(hcamcorder, FALSE);
-
- _mmcam_dbg_log("");
-
- if (hcamcorder->sync_state_change) {
- return TRUE;
- }
-
- _MMCAMCORDER_LOCK_STATE(handle);
-
- if (hcamcorder->target_state != hcamcorder->state) {
- hcamcorder->target_state = hcamcorder->state;
- _mmcam_dbg_log("Async state change is canceled.");
- _MMCAMCORDER_UNLOCK_STATE(handle);
- return TRUE;
- } else {
- _mmcam_dbg_log("Nothing to be cancel or Already processed.");
- }
-
- _MMCAMCORDER_UNLOCK_STATE(handle);
-
- return FALSE;
-}
-
-
-gboolean _mmcamcorder_is_state_changing(MMHandleType handle)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
- mmf_return_val_if_fail(hcamcorder, FALSE);
-
- _mmcam_dbg_log("(%d)", (hcamcorder->target_state != hcamcorder->state));
-
- if (hcamcorder->sync_state_change) {
- return FALSE;
- }
-
- _MMCAMCORDER_LOCK_STATE(handle);
-
- if (hcamcorder->target_state != hcamcorder->state) {
- _MMCAMCORDER_UNLOCK_STATE(handle);
- return TRUE;
- }
-
- _MMCAMCORDER_UNLOCK_STATE(handle);
-
- return FALSE;
-}
-
_MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type)
{
/* init members */
memset(sc, 0x00, sizeof(_MMCamcorderSubContext));
- sc->element_num = _MMCamcorder_PIPELINE_ELEMENT_NUM;
+ sc->element_num = _MMCAMCORDER_PIPELINE_ELEMENT_NUM;
+ sc->encode_element_num = _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM;
/* alloc info for each mode */
switch (type) {
case MM_CAMCORDER_MODE_AUDIO:
sc->info_audio = malloc( sizeof(_MMCamcorderAudioInfo));
- if(sc->info_audio == NULL) {
+ if(!sc->info_audio) {
_mmcam_dbg_err("Failed to alloc info structure");
- free(sc);
- return NULL;
+ goto ALLOC_SUBCONTEXT_FAILED;
}
memset(sc->info_audio, 0x00, sizeof(_MMCamcorderAudioInfo));
break;
case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
default:
sc->info_image = malloc( sizeof(_MMCamcorderImageInfo));
- if(sc->info_image == NULL) {
+ if(!sc->info_image) {
_mmcam_dbg_err("Failed to alloc info structure");
- free(sc);
- return NULL;
+ goto ALLOC_SUBCONTEXT_FAILED;
}
memset(sc->info_image, 0x00, sizeof(_MMCamcorderImageInfo));
sc->info_image->sound_status = _SOUND_STATUS_INIT;
sc->info_video = malloc( sizeof(_MMCamcorderVideoInfo));
- if(sc->info_video == NULL) {
+ if(!sc->info_video) {
_mmcam_dbg_err("Failed to alloc info structure");
- free(sc->info_image);
- free(sc);
- return NULL;
+ goto ALLOC_SUBCONTEXT_FAILED;
}
memset(sc->info_video, 0x00, sizeof(_MMCamcorderVideoInfo));
+ pthread_mutex_init(&(sc->info_video->size_check_lock), NULL);
break;
}
sc->element = (_MMCamcorderGstElement *)malloc(sizeof(_MMCamcorderGstElement) * sc->element_num);
if(!sc->element) {
_mmcam_dbg_err("Failed to alloc element structure");
- if (type == MM_CAMCORDER_MODE_AUDIO) {
- free(sc->info_audio);
- } else {
- free(sc->info_image);
- free(sc->info_video);
- }
- free(sc);
- return NULL;
+ goto ALLOC_SUBCONTEXT_FAILED;
+ }
+
+ sc->encode_element = (_MMCamcorderGstElement *)malloc(sizeof(_MMCamcorderGstElement) * sc->encode_element_num);
+ if(!sc->encode_element) {
+ _mmcam_dbg_err("Failed to alloc encode element structure");
+ goto ALLOC_SUBCONTEXT_FAILED;
}
- for (i = 0; i< sc->element_num; i++) {
+ for (i = 0 ; i < sc->element_num ; i++) {
sc->element[i].id = _MMCAMCORDER_NONE;
sc->element[i].gst = NULL;
}
- memset(sc->format_name, '\0', sizeof(sc->format_name));
+ for (i = 0 ; i < sc->encode_element_num ; i++) {
+ sc->encode_element[i].id = _MMCAMCORDER_NONE;
+ sc->encode_element[i].gst = NULL;
+ }
+
sc->cam_stability_count = 0;
sc->drop_vframe = 0;
sc->pass_first_vframe = 0;
sc->is_modified_rate = FALSE;
return sc;
+
+ALLOC_SUBCONTEXT_FAILED:
+ if (sc) {
+ if (sc->info_audio) {
+ free(sc->info_audio);
+ sc->info_audio = NULL;
+ }
+ if (sc->info_image) {
+ free(sc->info_image);
+ sc->info_image = NULL;
+ }
+ if (sc->info_video) {
+ pthread_mutex_destroy(&(sc->info_video->size_check_lock));
+ free(sc->info_video);
+ sc->info_video = NULL;
+ }
+ if (sc->element) {
+ free(sc->element);
+ sc->element = NULL;
+ }
+ if (sc->encode_element) {
+ free(sc->encode_element);
+ sc->encode_element = NULL;
+ }
+ free(sc);
+ sc = NULL;
+ }
+
+ return NULL;
}
if (sc) {
if (sc->element) {
+ _mmcam_dbg_log("release element");
free(sc->element);
sc->element = NULL;
}
+ if (sc->encode_element) {
+ _mmcam_dbg_log("release encode_element");
+ free(sc->encode_element);
+ sc->encode_element = NULL;
+ }
+
if (sc->info_image) {
_mmcam_dbg_log("release info_image");
free(sc->info_image);
if (sc->info_video) {
_mmcam_dbg_log("release info_video");
+ if (sc->info_video->filename) {
+ free(sc->info_video->filename);
+ sc->info_video->filename = NULL;
+ }
+ pthread_mutex_destroy(&(sc->info_video->size_check_lock));
free(sc->info_video);
sc->info_video = NULL;
}
if (sc->info_audio) {
_mmcam_dbg_log("release info_audio");
+ if (sc->info_audio->filename) {
+ free(sc->info_audio->filename);
+ sc->info_audio->filename = NULL;
+ }
free(sc->info_audio);
sc->info_audio = NULL;
}
gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpointer data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data);
- _MMCamcorderMsgItem msg;
_MMCamcorderSubContext *sc = NULL;
mmf_return_val_if_fail(hcamcorder, FALSE);
break;
case GST_MESSAGE_STATE_CHANGED:
{
- GValue *vnewstate;
+ const GValue *vnewstate;
GstState newstate;
GstElement *pipeline = NULL;
if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
if (message->src == (GstObject*)pipeline) {
- vnewstate = (GValue*)gst_structure_get_value(gst_message_get_structure(message), "new-state");
+ vnewstate = (GValue*)gst_structure_get_value(gst_message_get_structure(message), "new-state");
newstate = (GstState)vnewstate->data[0].v_int;
_mmcam_dbg_log("GST_MESSAGE_STATE_CHANGED[%s]",gst_element_state_get_name(newstate));
}
break;
case GST_MESSAGE_NEW_CLOCK:
{
- GstClock *clock;
- gst_message_parse_new_clock(message, &clock);
- _mmcam_dbg_log("GST_MESSAGE_NEW_CLOCK : %s", (clock ? GST_OBJECT_NAME (clock) : "NULL"));
+ GstClock *pipe_clock = NULL;
+ gst_message_parse_new_clock(message, &pipe_clock);
+ _mmcam_dbg_log("GST_MESSAGE_NEW_CLOCK : %s", (pipe_clock ? GST_OBJECT_NAME (pipe_clock) : "NULL"));
break;
}
case GST_MESSAGE_STRUCTURE_CHANGE:
break;
case GST_MESSAGE_ELEMENT:
_mmcam_dbg_log("GST_MESSAGE_ELEMENT");
-
- if (gst_structure_has_name(gst_message_get_structure(message), "avsysvideosrc-AF") ||
- gst_structure_has_name(gst_message_get_structure(message), "camerasrc-AF")) {
- int focus_state = 0;
-
- gst_structure_get_int(gst_message_get_structure(message), "focus-state", &focus_state);
- _mmcam_dbg_log("Focus State:%d", focus_state);
-
- msg.id = MM_MESSAGE_CAMCORDER_FOCUS_CHANGED;
- msg.param.code = focus_state;
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-HDR")) {
- int progress = 0;
- int status = 0;
-
- gst_structure_get_int(gst_message_get_structure(message), "progress", &progress);
- gst_structure_get_int(gst_message_get_structure(message), "status", &status);
- _mmcam_dbg_log("HDR progress %d percent, status %d", progress, status);
-
- msg.id = MM_MESSAGE_CAMCORDER_HDR_PROGRESS;
- msg.param.code = progress;
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-FD")) {
- int i = 0;
- const GValue *g_value = gst_structure_get_value(gst_message_get_structure(message), "face-info");;
- GstCameraControlFaceDetectInfo *fd_info = NULL;
- MMCamFaceDetectInfo *cam_fd_info = NULL;
-
- if (g_value) {
- fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value);
- }
-
- if (fd_info == NULL) {
- _mmcam_dbg_warn("fd_info is NULL");
- return TRUE;
- }
-
- cam_fd_info = (MMCamFaceDetectInfo *)malloc(sizeof(MMCamFaceDetectInfo));
- if (cam_fd_info == NULL) {
- _mmcam_dbg_warn("cam_fd_info alloc failed");
-
- free(fd_info);
- fd_info = NULL;
-
- return TRUE;
- }
-
- /* set total face count */
- cam_fd_info->num_of_faces = fd_info->num_of_faces;
-
- if (cam_fd_info->num_of_faces > 0) {
- cam_fd_info->face_info = (MMCamFaceInfo *)malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces);
- if (cam_fd_info->face_info) {
- /* set information of each face */
- for (i = 0 ; i < fd_info->num_of_faces ; i++) {
- cam_fd_info->face_info[i].id = fd_info->face_info[i].id;
- cam_fd_info->face_info[i].score = fd_info->face_info[i].score;
- cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x;
- cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y;
- cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width;
- cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height;
- /*
- _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]",
- fd_info->face_info[i].id,
- fd_info->face_info[i].score,
- fd_info->face_info[i].rect.x,
- fd_info->face_info[i].rect.y,
- fd_info->face_info[i].rect.width,
- fd_info->face_info[i].rect.height);
- */
- }
- } else {
- _mmcam_dbg_warn("MMCamFaceInfo alloc failed");
-
- /* free allocated memory that is not sent */
- free(cam_fd_info);
- cam_fd_info = NULL;
- }
- } else {
- cam_fd_info->face_info = NULL;
- }
-
- if (cam_fd_info) {
- /* send message - cam_fd_info should be freed by application */
- msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO;
- msg.param.data = cam_fd_info;
- msg.param.size = sizeof(MMCamFaceDetectInfo);
- msg.param.code = 0;
-
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- }
-
- /* free fd_info allocated by plugin */
- free(fd_info);
- fd_info = NULL;
- }
break;
case GST_MESSAGE_SEGMENT_START:
_mmcam_dbg_log("GST_MESSAGE_SEGMENT_START");
case GST_MESSAGE_SEGMENT_DONE:
_mmcam_dbg_log("GST_MESSAGE_SEGMENT_DONE");
break;
- case GST_MESSAGE_DURATION:
- _mmcam_dbg_log("GST_MESSAGE_DURATION");
+ case GST_MESSAGE_DURATION_CHANGED:
+ _mmcam_dbg_log("GST_MESSAGE_DURATION_CHANGED");
break;
case GST_MESSAGE_LATENCY:
_mmcam_dbg_log("GST_MESSAGE_LATENCY");
case GST_MESSAGE_ANY:
_mmcam_dbg_log("GST_MESSAGE_ANY");
break;
+ case GST_MESSAGE_QOS:
+// _mmcam_dbg_log("GST_MESSAGE_QOS");
+ break;
default:
_mmcam_dbg_log("not handled message type=(%d)", GST_MESSAGE_TYPE(message));
break;
/* parse error message */
gst_message_parse_error(message, &err, &debug_info);
- if (!err) {
- _mmcam_dbg_warn("failed to parse error message");
- return GST_BUS_PASS;
- }
-
if (debug_info) {
_mmcam_dbg_err("GST ERROR : %s", debug_info);
g_free(debug_info);
debug_info = NULL;
}
+ if (!err) {
+ _mmcam_dbg_warn("failed to parse error message");
+ return GST_BUS_PASS;
+ }
+
/* set videosrc element to compare */
element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
_mmcam_dbg_err("Camera device [busy]");
sc->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY;
break;
- case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
case GST_RESOURCE_ERROR_OPEN_WRITE:
_mmcam_dbg_err("Camera device [open failed]");
+ sc->error_code = MM_ERROR_COMMON_INVALID_PERMISSION;
+ //sc->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN; // SECURITY PART REQUEST PRIVILEGE
+ break;
+ case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
+ _mmcam_dbg_err("Camera device [open failed]");
sc->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN;
break;
case GST_RESOURCE_ERROR_OPEN_READ:
/* store error code and drop this message if cmd is running */
if (sc->error_code != MM_ERROR_NONE) {
- if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
- _mmcam_dbg_err("cmd is running and will be returned with this error %x",
- sc->error_code);
- return GST_BUS_DROP;
- }
+ _MMCamcorderMsgItem msg;
+
+ /* post error to application */
+ sc->error_occurs = TRUE;
+ msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+ msg.param.code = sc->error_code;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
+ goto DROP_MESSAGE;
}
- }
+ } else if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
+ _MMCamcorderMsgItem msg;
- return GST_BUS_PASS;
-}
+ if (gst_structure_has_name(gst_message_get_structure(message), "avsysvideosrc-AF") ||
+ gst_structure_has_name(gst_message_get_structure(message), "camerasrc-AF")) {
+ int focus_state = 0;
+ gst_structure_get_int(gst_message_get_structure(message), "focus-state", &focus_state);
+ _mmcam_dbg_log("Focus State:%d", focus_state);
-static int __mmcamcorder_asm_get_event_type(int sessionType)
-{
- switch (sessionType) {
- case MM_SESSION_TYPE_SHARE:
- return ASM_EVENT_SHARE_MMCAMCORDER;
- case MM_SESSION_TYPE_EXCLUSIVE:
- return ASM_EVENT_EXCLUSIVE_MMCAMCORDER;
- case MM_SESSION_TYPE_NOTIFY:
- return ASM_EVENT_NOTIFY;
- case MM_SESSION_TYPE_CALL:
- return ASM_EVENT_CALL;
- case MM_SESSION_TYPE_VIDEOCALL:
- return ASM_EVENT_VIDEOCALL;
- case MM_SESSION_TYPE_ALARM:
- return ASM_EVENT_ALARM;
- default:
- return ASM_EVENT_SHARE_MMCAMCORDER;
- }
-}
+ msg.id = MM_MESSAGE_CAMCORDER_FOCUS_CHANGED;
+ msg.param.code = focus_state;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
-ASM_cb_result_t _mmcamcorder_asm_callback_sh(int handle, ASM_event_sources_t event_src,
- ASM_sound_commands_t command,
- unsigned int sound_status, void* cb_data)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(cb_data);
- int current_state = MM_CAMCORDER_STATE_NONE;
- ASM_cb_result_t cb_res = ASM_CB_RES_NONE;
+ goto DROP_MESSAGE;
+ } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-HDR")) {
+ int progress = 0;
+ int status = 0;
- mmf_return_val_if_fail((MMHandleType)hcamcorder, ASM_CB_RES_NONE);
+ if (gst_structure_get_int(gst_message_get_structure(message), "progress", &progress)) {
+ gst_structure_get_int(gst_message_get_structure(message), "status", &status);
+ _mmcam_dbg_log("HDR progress %d percent, status %d", progress, status);
- current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
- if (current_state <= MM_CAMCORDER_STATE_NONE ||
- current_state >= MM_CAMCORDER_STATE_NUM) {
- _mmcam_dbg_err("Abnormal state. Or null handle. (%p, %d, %d)", hcamcorder, command, current_state);
- }
+ msg.id = MM_MESSAGE_CAMCORDER_HDR_PROGRESS;
+ msg.param.code = progress;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ }
- /* set value to inform a status is changed by asm */
- hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
- /* set ASM event code for sending it to application */
- hcamcorder->asm_event_code = event_src;
+ goto DROP_MESSAGE;
+ } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-FD")) {
+ int i = 0;
+ const GValue *g_value = gst_structure_get_value(gst_message_get_structure(message), "face-info");;
+ GstCameraControlFaceDetectInfo *fd_info = NULL;
+ MMCamFaceDetectInfo *cam_fd_info = NULL;
- _mmcam_dbg_log("ASM SHARE callback : event code 0x%x, command 0x%x", event_src, command);
+ if (g_value) {
+ fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value);
+ }
- switch (command) {
- case ASM_COMMAND_STOP:
- case ASM_COMMAND_PAUSE:
- _mmcam_dbg_log("Got msg from asm to Stop or Pause(%d, %d)", command, current_state);
+ if (fd_info == NULL) {
+ _mmcam_dbg_warn("fd_info is NULL");
+ goto DROP_MESSAGE;
+ }
- __mmcamcorder_force_stop(hcamcorder);
- cb_res = ASM_CB_RES_STOP;
+ cam_fd_info = (MMCamFaceDetectInfo *)malloc(sizeof(MMCamFaceDetectInfo));
+ if (cam_fd_info == NULL) {
+ _mmcam_dbg_warn("cam_fd_info alloc failed");
- _mmcam_dbg_log("Finish opeartion. Camera is released.(%d)", cb_res);
- break;
- case ASM_COMMAND_PLAY:
- _mmcam_dbg_log("Got msg from asm to Play(%d, %d)", command, current_state);
+ free(fd_info);
+ fd_info = NULL;
- if (current_state >= MM_CAMCORDER_STATE_PREPARE) {
- _mmcam_dbg_log("Already start previewing");
- } else {
- __mmcamcorder_force_resume(hcamcorder);
- }
-
- cb_res = ASM_CB_RES_PLAYING;
-
- _mmcam_dbg_log("Finish opeartion. Preview is started.(%d)", cb_res);
- break;
- case ASM_COMMAND_RESUME:
- {
- _MMCamcorderMsgItem msg;
-
- _mmcam_dbg_log("Got msg from asm to Resume(%d, %d)", command, current_state);
-
- msg.id = MM_MESSAGE_READY_TO_RESUME;
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- cb_res = ASM_CB_RES_PLAYING;
-
- _mmcam_dbg_log("Finish opeartion.(%d)", cb_res);
- break;
- }
- default: /* should not be reached here */
- cb_res = ASM_CB_RES_PLAYING;
- _mmcam_dbg_err("Command err.");
- break;
- }
-
- /* restore value */
- hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL;
-
- return cb_res;
-}
-
-
-ASM_cb_result_t _mmcamcorder_asm_callback_ex(int handle, ASM_event_sources_t event_src,
- ASM_sound_commands_t command,
- unsigned int sound_status, void* cb_data)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(cb_data);
- int current_state = MM_CAMCORDER_STATE_NONE;
- ASM_cb_result_t cb_res = ASM_CB_RES_NONE;
+ goto DROP_MESSAGE;
+ }
- mmf_return_val_if_fail((MMHandleType)hcamcorder, ASM_CB_RES_NONE);
+ /* set total face count */
+ cam_fd_info->num_of_faces = fd_info->num_of_faces;
- current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
+ if (cam_fd_info->num_of_faces > 0) {
+ cam_fd_info->face_info = (MMCamFaceInfo *)malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces);
+ if (cam_fd_info->face_info) {
+ /* set information of each face */
+ for (i = 0 ; i < fd_info->num_of_faces ; i++) {
+ cam_fd_info->face_info[i].id = fd_info->face_info[i].id;
+ cam_fd_info->face_info[i].score = fd_info->face_info[i].score;
+ cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x;
+ cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y;
+ cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width;
+ cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height;
+ /*
+ _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]",
+ fd_info->face_info[i].id,
+ fd_info->face_info[i].score,
+ fd_info->face_info[i].rect.x,
+ fd_info->face_info[i].rect.y,
+ fd_info->face_info[i].rect.width,
+ fd_info->face_info[i].rect.height);
+ */
+ }
+ } else {
+ _mmcam_dbg_warn("MMCamFaceInfo alloc failed");
- _mmcam_dbg_log("ASM EXCLUSIVE callback : event code 0x%x, command 0x%x, current state %d",
- event_src, command, current_state);
+ /* free allocated memory that is not sent */
+ free(cam_fd_info);
+ cam_fd_info = NULL;
+ }
+ } else {
+ cam_fd_info->face_info = NULL;
+ }
- /* set value to inform a status is changed by asm */
- hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
+ if (cam_fd_info) {
+ /* send message - cam_fd_info should be freed by application */
+ msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO;
+ msg.param.data = cam_fd_info;
+ msg.param.size = sizeof(MMCamFaceDetectInfo);
+ msg.param.code = 0;
- /* set ASM event code for sending it to application */
- hcamcorder->asm_event_code = event_src;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ }
- switch (command) {
- case ASM_COMMAND_STOP:
- case ASM_COMMAND_PAUSE:
- _mmcam_dbg_log("Got msg from asm to Stop or Pause(%d, %d)", command, current_state);
+ /* free fd_info allocated by plugin */
+ free(fd_info);
+ fd_info = NULL;
- __mmcamcorder_force_stop(hcamcorder);
- cb_res = ASM_CB_RES_STOP;
+ goto DROP_MESSAGE;
+ } else if (gst_structure_has_name(gst_message_get_structure(message), "camerasrc-Capture")) {
+ int capture_done = FALSE;
- _mmcam_dbg_log("Finish opeartion. Camera is released.(%d)", cb_res);
- break;
- case ASM_COMMAND_PLAY:
- _mmcam_dbg_log("Got msg from asm to Play(%d, %d)", command, current_state);
+ if (gst_structure_get_int(gst_message_get_structure(message), "capture-done", &capture_done)) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+ if (sc && sc->info_image) {
+ /* play capture sound */
+ _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
+ }
+ }
- if (current_state >= MM_CAMCORDER_STATE_PREPARE) {
- _mmcam_dbg_log("Already start previewing");
- } else {
- __mmcamcorder_force_resume(hcamcorder);
+ goto DROP_MESSAGE;
}
-
- cb_res = ASM_CB_RES_PLAYING;
-
- _mmcam_dbg_log("Finish opeartion. Preview is started.(%d)", cb_res);
- break;
- case ASM_COMMAND_RESUME:
- {
- _MMCamcorderMsgItem msg;
-
- _mmcam_dbg_log("Got msg from asm to Resume(%d, %d)", command, current_state);
-
- msg.id = MM_MESSAGE_READY_TO_RESUME;
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- cb_res = ASM_CB_RES_PLAYING;
-
- _mmcam_dbg_log("Finish opeartion.(%d)", cb_res);
- break;
- }
- default: /* should not be reached here */
- cb_res = ASM_CB_RES_PLAYING;
- _mmcam_dbg_err("Command err.");
- break;
}
- /* restore value */
- hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL;
+ return GST_BUS_PASS;
+
+DROP_MESSAGE:
+ gst_message_unref(message);
+ message = NULL;
- return cb_res;
+ return GST_BUS_DROP;
}
switch (type) {
case MM_CAMCORDER_MODE_AUDIO:
- __ta__(" _mmcamcorder_create_audio_pipeline",
ret = _mmcamcorder_create_audio_pipeline(handle);
- );
if (ret != MM_ERROR_NONE) {
return ret;
}
break;
case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
default:
- __ta__(" _mmcamcorder_create_preview_pipeline",
ret = _mmcamcorder_create_preview_pipeline(handle);
- );
if (ret != MM_ERROR_NONE) {
return ret;
}
/* connect capture signal */
if (!sc->bencbin_capture) {
- __ta__(" _mmcamcorder_connect_capture_signal",
ret = _mmcamcorder_connect_capture_signal(handle);
- );
if (ret != MM_ERROR_NONE) {
return ret;
}
pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
if (type != MM_CAMCORDER_MODE_AUDIO) {
- if (hcamcorder->sync_state_change) {
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
- } else {
- ret = _mmcamcorder_gst_set_state_async(handle, pipeline, GST_STATE_READY);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- return MM_ERROR_CAMCORDER_GST_STATECHANGE;
- }
- }
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
}
#ifdef _MMCAMCORDER_GET_DEVICE_INFO
if (!_mmcamcorder_get_device_info(handle)) {
_mmcam_dbg_err("Getting device information error!!");
}
#endif
- _mmcam_dbg_log("ret[%x]", ret);
+ _mmcam_dbg_log("ret[%x]", ret);
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_err("error : destroy pipeline");
_mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
void _mmcamcorder_destroy_pipeline(MMHandleType handle, int type)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderSubContext *sc = NULL;
+ _MMCamcorderSubContext *sc = NULL;
gint i = 0;
+ int element_num = 0;
+ _MMCamcorderGstElement *element = NULL;
GstBus *bus = NULL;
mmf_return_if_fail(hcamcorder);
_mmcam_dbg_log("");
- bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
-
/* Inside each pipeline destroy function, Set GST_STATE_NULL to Main pipeline */
switch (type) {
case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
+ element = sc->element;
+ element_num = sc->element_num;
+ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
_mmcamcorder_destroy_video_capture_pipeline(handle);
break;
case MM_CAMCORDER_MODE_AUDIO:
+ element = sc->encode_element;
+ element_num = sc->encode_element_num;
+ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
_mmcamcorder_destroy_audio_pipeline(handle);
break;
default:
_mmcam_dbg_log("Pipeline clear!!");
/* Remove pipeline message callback */
- g_source_remove(hcamcorder->pipeline_cb_event_id);
+ if (hcamcorder->pipeline_cb_event_id > 0) {
+ g_source_remove(hcamcorder->pipeline_cb_event_id);
+ hcamcorder->pipeline_cb_event_id = 0;
+ }
/* Remove remained message in bus */
- if (bus != NULL) {
+ if (bus) {
GstMessage *gst_msg = NULL;
while ((gst_msg = gst_bus_pop(bus)) != NULL) {
_mmcamcorder_pipeline_cb_message(bus, gst_msg, (gpointer)hcamcorder);
}
/* checking unreleased element */
- for (i = 0 ; i < _MMCamcorder_PIPELINE_ELEMENT_NUM ; i++ ) {
- if (sc->element[i].gst) {
- if (GST_IS_ELEMENT(sc->element[i].gst)) {
+ for (i = 0 ; i < element_num ; i++ ) {
+ if (element[i].gst) {
+ if (GST_IS_ELEMENT(element[i].gst)) {
_mmcam_dbg_warn("Still alive element - ID[%d], name [%s], ref count[%d], status[%s]",
- sc->element[i].id,
- GST_OBJECT_NAME(sc->element[i].gst),
- GST_OBJECT_REFCOUNT_VALUE(sc->element[i].gst),
- gst_element_state_get_name (GST_STATE (sc->element[i].gst)));
- g_object_weak_unref(G_OBJECT(sc->element[i].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sc);
+ element[i].id,
+ GST_OBJECT_NAME(element[i].gst),
+ GST_OBJECT_REFCOUNT(element[i].gst),
+ gst_element_state_get_name(GST_STATE(element[i].gst)));
+ g_object_weak_unref(G_OBJECT(element[i].gst), (GWeakNotify)_mmcamcorder_element_release_noti, sc);
} else {
- _mmcam_dbg_warn("The element[%d] is still aliving, check it", sc->element[i].id);
+ _mmcam_dbg_warn("The element[%d] is still aliving, check it", element[i].id);
}
- sc->element[i].id = _MMCAMCORDER_NONE;
- sc->element[i].gst = NULL;
+ element[i].id = _MMCAMCORDER_NONE;
+ element[i].gst = NULL;
}
}
+
+ return;
}
#endif /* _MMCAMCORDER_USE_SET_ATTR_CB */
-int _mmcamcorder_gst_set_state (MMHandleType handle, GstElement *pipeline, GstState target_state)
+int _mmcamcorder_gst_set_state(MMHandleType handle, GstElement *pipeline, GstState target_state)
{
unsigned int k = 0;
+ _MMCamcorderSubContext *sc = NULL;
GstState pipeline_state = GST_STATE_VOID_PENDING;
GstStateChangeReturn setChangeReturn = GST_STATE_CHANGE_FAILURE;
GstStateChangeReturn getChangeReturn = GST_STATE_CHANGE_FAILURE;
GstClockTime get_timeout = __MMCAMCORDER_SET_GST_STATE_TIMEOUT * GST_SECOND;
+ pthread_mutex_t *state_lock = NULL;
mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("Set state to %d", target_state);
+ if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst == pipeline) {
+ _mmcam_dbg_log("Set state to %d - PREVIEW PIPELINE", target_state);
+ state_lock = &_MMCAMCORDER_GET_GST_STATE_LOCK(handle);
+ } else {
+ _mmcam_dbg_log("Set state to %d - ENDODE PIPELINE", target_state);
+ state_lock = &_MMCAMCORDER_GET_GST_ENCODE_STATE_LOCK(handle);
+ }
- _MMCAMCORDER_LOCK_GST_STATE(handle);
+ pthread_mutex_lock(state_lock);
for (k = 0; k < _MMCAMCORDER_STATE_SET_COUNT; k++) {
setChangeReturn = gst_element_set_state(pipeline, target_state);
case GST_STATE_CHANGE_SUCCESS:
/* if we reached the final target state, exit */
if (pipeline_state == target_state) {
- _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+ _mmcam_dbg_log("Set state to %d - DONE", target_state);
+ pthread_mutex_unlock(state_lock);
return MM_ERROR_NONE;
}
break;
_mmcam_dbg_log("status=GST_STATE_CHANGE_ASYNC.");
break;
default:
- _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+ pthread_mutex_unlock(state_lock);
_mmcam_dbg_log("status=GST_STATE_CHANGE_FAILURE.");
return MM_ERROR_CAMCORDER_GST_STATECHANGE;
}
- _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+ pthread_mutex_unlock(state_lock);
+
_mmcam_dbg_err("timeout of gst_element_get_state()!!");
+
return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
}
usleep(_MMCAMCORDER_STATE_CHECK_INTERVAL);
}
- _MMCAMCORDER_UNLOCK_GST_STATE(handle);
+ pthread_mutex_unlock(state_lock);
_mmcam_dbg_err("Failure. gst_element_set_state timeout!!");
- return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
+ return MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT;
}
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, -1);
-
+
return sc->kpi.current_fps;
}
return;
}
-/* Async state change */
-void _mmcamcorder_delete_command_info(__MMCamcorderCmdInfo *cmdinfo)
-{
- if (cmdinfo) {
- g_free(cmdinfo);
- }
-}
-
-static void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder)
-{
- int i = 0;
- int loop = 0;
- int itr_cnt = 0;
- int result = MM_ERROR_NONE;
- int current_state = MM_CAMCORDER_STATE_NONE;
-
- mmf_return_if_fail(hcamcorder);
-
- current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-
- _mmcam_dbg_log( "Force STOP MMFW Camcorder" );
-
- for (loop = 0 ; current_state > MM_CAMCORDER_STATE_NULL && loop < __MMCAMCORDER_CMD_ITERATE_MAX * 3 ; loop++) {
- itr_cnt = __MMCAMCORDER_CMD_ITERATE_MAX;
- switch (current_state) {
- case MM_CAMCORDER_STATE_CAPTURING:
- {
- _MMCamcorderSubContext *sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
- _MMCamcorderImageInfo *info = NULL;
-
- mmf_return_if_fail(sc);
- mmf_return_if_fail((info = sc->info_image));
-
- _mmcam_dbg_log("Stop capturing.");
-
- /* if caturing isn't finished, waiting for 2 sec to finish real capture operation. check 'info->capturing'. */
- mm_camcorder_set_attributes((MMHandleType)hcamcorder, NULL,
- MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT, TRUE,
- NULL);
-
- for (i = 0; i < 20 && info->capturing; i++) {
- usleep(100000);
- }
-
- if (i == 20) {
- _mmcam_dbg_err("Timeout. Can't check stop capturing.");
- }
-
- while ((itr_cnt--) && ((result = _mmcamcorder_capture_stop((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
- _mmcam_dbg_warn("Can't stop capturing.(%x)", result);
- }
-
- break;
- }
- case MM_CAMCORDER_STATE_RECORDING:
- case MM_CAMCORDER_STATE_PAUSED:
- {
- _mmcam_dbg_log("Stop recording.");
-
- while ((itr_cnt--) && ((result = _mmcamcorder_commit((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
- _mmcam_dbg_warn("Can't commit.(%x)", result);
- }
- break;
- }
- case MM_CAMCORDER_STATE_PREPARE:
- {
- _mmcam_dbg_log("Stop preview.");
-
- while ((itr_cnt--) && ((result = _mmcamcorder_stop((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
- _mmcam_dbg_warn("Can't stop preview.(%x)", result);
- }
- break;
- }
- case MM_CAMCORDER_STATE_READY:
- {
- _mmcam_dbg_log("unrealize");
-
- if ((result = _mmcamcorder_unrealize((MMHandleType)hcamcorder)) != MM_ERROR_NONE) {
- _mmcam_dbg_warn("Can't unrealize.(%x)", result);
- }
- break;
- }
- case MM_CAMCORDER_STATE_NULL:
- default:
- _mmcam_dbg_log("Already stopped.");
- break;
- }
-
- current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
- }
-
- _mmcam_dbg_log( "Done." );
-
- return;
-}
-
-
-static void __mmcamcorder_force_resume(mmf_camcorder_t *hcamcorder)
-{
- int loop = 0;
- int result = MM_ERROR_NONE;
- int itr_cnt = 0;
- int current_state = MM_CAMCORDER_STATE_NONE;
-
- mmf_return_if_fail(hcamcorder);
-
- _mmcam_dbg_log("Force RESUME MMFW Camcorder");
-
- current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
-
- for (loop = 0 ; current_state < MM_CAMCORDER_STATE_PREPARE && loop < __MMCAMCORDER_CMD_ITERATE_MAX * 3 ; loop++) {
- itr_cnt = __MMCAMCORDER_CMD_ITERATE_MAX;
-
- switch (current_state) {
- case MM_CAMCORDER_STATE_NULL:
- _mmcam_dbg_log("Realize");
- while ((itr_cnt--) && ((result = _mmcamcorder_realize((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
- _mmcam_dbg_warn("Can't realize.(%x)", result);
- }
- break;
- case MM_CAMCORDER_STATE_READY:
- _mmcam_dbg_log("Start previewing");
-
- while ((itr_cnt--) && ((result = _mmcamcorder_start((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
- _mmcam_dbg_warn("Can't start previewing.(%x)", result);
- }
- break;
- default:
- _mmcam_dbg_log("Abnormal state.");
- break;
- }
-
- current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder);
- }
-
- _mmcam_dbg_log( "Done." );
-
- return;
-}
-
-int _mmcamcorder_create_command_loop(MMHandleType handle)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderCommand *cmd;
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- _mmcam_dbg_log("");
-
- cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
- cmd->cmd_queue = g_queue_new();
- mmf_return_val_if_fail(cmd->cmd_queue, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
- sem_init(&cmd->sema, 0, 0);
-
- if (pthread_create(&cmd->pCommandThread, NULL, _mmcamcorder_command_loop_thread, hcamcorder)) {
- perror("Make Command Thread Fail");
- return MM_ERROR_COMMON_UNKNOWN;
- }
-
- return MM_ERROR_NONE;
-}
-
-
-int _mmcamcorder_destroy_command_loop(MMHandleType handle)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderCommand *cmd;
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
-
- cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
- mmf_return_val_if_fail(cmd->cmd_queue, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
- _mmcamcorder_append_simple_command(handle, _MMCAMCORDER_CMD_QUIT);
-
- sem_post(&cmd->sema); /* why is this needed? */
-
- _mmcam_dbg_log("wait for pthread join");
-
- pthread_join(cmd->pCommandThread, NULL);
-
- _mmcam_dbg_log("pthread join!!");
-
- sem_destroy(&cmd->sema);
-
- while (!g_queue_is_empty(cmd->cmd_queue)) {
- __MMCamcorderCmdInfo *info = NULL;
- info = g_queue_pop_head(cmd->cmd_queue);
- _mmcamcorder_delete_command_info(info);
- }
- g_queue_free(cmd->cmd_queue);
-
- _mmcam_dbg_log("Command loop clear.");
-
- return MM_ERROR_NONE;
-}
-
-
-int _mmcamcorder_append_command(MMHandleType handle, __MMCamcorderCmdInfo *info)
-{
- int value = 0;
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderCommand *cmd;
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- _mmcam_dbg_log("");
-
- cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
- mmf_return_val_if_fail(cmd->cmd_queue, MM_ERROR_CAMCORDER_INVALID_CONDITION);
-
- g_queue_push_tail (cmd->cmd_queue, (gpointer)info);
-
- sem_getvalue(&cmd->sema, &value);
-
- if (value == 0) {
- sem_post(&cmd->sema);
- } else {
- /* Don't need to post. */
- }
-
- return MM_ERROR_NONE;
-}
-
-
-int _mmcamcorder_append_simple_command(MMHandleType handle, _MMCamcorderCommandType type)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- __MMCamcorderCmdInfo *info = NULL;
-
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- _mmcam_dbg_log("Command Type=%d", type);
-
- info = (__MMCamcorderCmdInfo*)malloc(sizeof(__MMCamcorderCmdInfo));
-
- info->handle = handle;
- info->type = type;
-
- _mmcamcorder_append_command(handle, info);
-
- return MM_ERROR_NONE;
-}
-
-
-void *_mmcamcorder_command_loop_thread(void *arg)
-{
- gboolean bExit_loop = FALSE;
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(arg);
- _MMCamcorderCommand *cmd = NULL;
- __MMCamcorderCmdInfo *cmdinfo = NULL;
-
- mmf_return_val_if_fail(hcamcorder, NULL);
-
- cmd = (_MMCamcorderCommand *)&(hcamcorder->cmd);
- mmf_return_val_if_fail(cmd->cmd_queue, NULL);
-
- _mmcam_dbg_log("");
-
- while (!bExit_loop) {
- sem_wait(&cmd->sema);
-
- /* send command */
- while (!g_queue_is_empty (cmd->cmd_queue)) {
- int bRet = MM_ERROR_NONE;
-
- cmdinfo = g_queue_pop_head(cmd->cmd_queue);
- if (cmdinfo->handle == (MMHandleType)NULL) {
- _mmcam_dbg_log("Handle in cmdinfo is Null.");
- bRet = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
- } else {
- switch (cmdinfo->type) {
- case _MMCAMCORDER_CMD_CREATE:
- case _MMCAMCORDER_CMD_DESTROY:
- case _MMCAMCORDER_CMD_CAPTURESTART:
- case _MMCAMCORDER_CMD_CAPTURESTOP:
- case _MMCAMCORDER_CMD_RECORD:
- case _MMCAMCORDER_CMD_PAUSE:
- case _MMCAMCORDER_CMD_COMMIT:
- __ta__("_mmcamcorder_commit",
- bRet = _mmcamcorder_commit(cmdinfo->handle);
- );
- break;
- case _MMCAMCORDER_CMD_CANCEL:
- //Not used yet.
- break;
- case _MMCAMCORDER_CMD_REALIZE:
- __ta__("_mmcamcorder_realize",
- bRet = _mmcamcorder_realize(cmdinfo->handle);
- );
- break;
- case _MMCAMCORDER_CMD_UNREALIZE:
- __ta__("_mmcamcorder_unrealize",
- bRet = _mmcamcorder_unrealize(cmdinfo->handle);
- );
- break;
- case _MMCAMCORDER_CMD_START:
- __ta__("_mmcamcorder_start",
- bRet = _mmcamcorder_start(cmdinfo->handle);
- );
- break;
- case _MMCAMCORDER_CMD_STOP:
- __ta__("_mmcamcorder_stop",
- bRet = _mmcamcorder_stop(cmdinfo->handle);
- );
- break;
- case _MMCAMCORDER_CMD_QUIT:
- _mmcam_dbg_log("Exit command loop!!");
- bExit_loop = TRUE;
- break;
- default:
- _mmcam_dbg_log("Wrong command type!!!");
- break;
- }
- }
-
- if (bRet != MM_ERROR_NONE) {
- _mmcam_dbg_log("Error on command process!(%x)", bRet);
- /* Do something? */
- }
-
- _mmcamcorder_delete_command_info(cmdinfo);
-
- if (bExit_loop) {
- break;
- }
- usleep(1);
- }
- }
-
- return NULL;
-}
-
static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage *message, GError *error)
{
_MMCamcorderMsgItem msg;
gchar *msg_src_element;
_MMCamcorderSubContext *sc = NULL;
-
+
return_val_if_fail(hcamcorder, FALSE);
return_val_if_fail(error, FALSE);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
/* Specific plugin - video encoder plugin */
- element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst);
+ element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
if (GST_ELEMENT_CAST(message->src) == element) {
if (code == GST_CORE_ERROR_NEGOTIATION) {
case GST_CORE_ERROR_SEEK:
case GST_CORE_ERROR_NOT_IMPLEMENTED:
case GST_CORE_ERROR_FAILED:
- case GST_CORE_ERROR_TOO_LAZY:
+ case GST_CORE_ERROR_TOO_LAZY:
case GST_CORE_ERROR_PAD:
case GST_CORE_ERROR_THREAD:
case GST_CORE_ERROR_EVENT:
}
/* encodebin */
- element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst);
+ element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
if (GST_ELEMENT_CAST(message->src) == element) {
if (code == GST_RESOURCE_ERROR_FAILED) {
_mmcam_dbg_err("Encoder [Resource error]");
/* Specific plugin */
/* video encoder */
- element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst);
+ element = GST_ELEMENT_CAST(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst);
if (GST_ELEMENT_CAST(message->src) == element) {
switch (code) {
case GST_STREAM_ERROR_WRONG_TYPE:
"WDR"
};
+static int __enum_conv_flip_ctrl[MM_CAMCORDER_FLIP_NUM];
+
+_MMCamcorderEnumConvert _mmcamcorder_enum_conv_flip_ctrl =
+{
+ MM_CAMCORDER_FLIP_NUM,
+ __enum_conv_flip_ctrl,
+ CONFIGURE_CATEGORY_CTRL_EFFECT,
+ "Flip"
+};
+
+static int __enum_conv_rotation_ctrl[MM_CAMCORDER_ROTATION_NUM];
+
+_MMCamcorderEnumConvert _mmcamcorder_enum_conv_rotation_ctrl =
+{
+ MM_CAMCORDER_ROTATION_NUM,
+ __enum_conv_rotation_ctrl,
+ CONFIGURE_CATEGORY_CTRL_EFFECT,
+ "Rotation"
+};
+
static int __enum_conv_ahs[MM_CAMCORDER_AHS_NUM];
},
{
CONFIGURE_TYPE_CTRL,
+ CONFIGURE_CATEGORY_CTRL_EFFECT,
+ MM_CAM_CAMERA_FLIP,
+ MM_CAMCORDER_ATTR_NONE,
+ "Flip",
+ MM_CAMCONVERT_TYPE_INT_ARRAY,
+ &_mmcamcorder_enum_conv_flip_ctrl,
+ },
+ {
+ CONFIGURE_TYPE_CTRL,
+ CONFIGURE_CATEGORY_CTRL_EFFECT,
+ MM_CAM_CAMERA_ROTATION,
+ MM_CAMCORDER_ATTR_NONE,
+ "Rotation",
+ MM_CAMCONVERT_TYPE_INT_ARRAY,
+ &_mmcamcorder_enum_conv_rotation_ctrl,
+ },
+ {
+ CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
MM_CAM_CAMERA_DIGITAL_ZOOM,
MM_CAMCORDER_ATTR_NONE,
MM_CAMCONVERT_TYPE_INT_RANGE,
NULL,
},
- {
+ { /* 20 */
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
MM_CAM_CAMERA_OPTICAL_ZOOM,
MM_CAMCONVERT_TYPE_INT_ARRAY,
&_mmcamcorder_enum_conv_focus_mode,
},
- { /* 20 */
+ {
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
MM_CAM_CAMERA_AF_SCAN_RANGE,
MM_CAMCONVERT_TYPE_INT_ARRAY,
NULL,
},
- { /* 25 */
+ {
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
MM_CAM_CAMERA_ISO,
MM_CAMCONVERT_TYPE_INT_ARRAY,
&_mmcamcorder_enum_conv_ahs,
},
- {
+ { /* 30 */
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_CAPTURE,
MM_CAM_CAPTURE_FORMAT,
MM_CAMCONVERT_TYPE_INT_RANGE,
NULL,
},
- { /* 30 */
+ {
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_CAPTURE,
MM_CAM_CAPTURE_COUNT,
MM_CAMCONVERT_TYPE_INT_RANGE,
NULL,
},
- { /* 35 */
+ {
CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_DETECT,
MM_CAM_DETECT_SELECT_NUMBER,
},
{
CONFIGURE_TYPE_CTRL,
- CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
- MM_CAM_CAMERA_FACE_ZOOM_MODE,
- MM_CAMCORDER_ATTR_NONE,
- "FaceZoomMode",
- MM_CAMCONVERT_TYPE_INT_ARRAY,
- NULL,
- },
- {
- CONFIGURE_TYPE_CTRL,
- CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH,
- MM_CAM_CAMERA_FACE_ZOOM_LEVEL,
- MM_CAMCORDER_ATTR_NONE,
- "FaceZoomLevel",
- MM_CAMCONVERT_TYPE_INT_RANGE,
- NULL,
- },
- {
- CONFIGURE_TYPE_CTRL,
CONFIGURE_CATEGORY_CTRL_CAMERA,
MM_CAM_RECOMMEND_CAMERA_WIDTH,
MM_CAM_RECOMMEND_CAMERA_HEIGHT,
"VideoStabilization",
MM_CAMCONVERT_TYPE_INT_ARRAY,
&_mmcamcorder_enum_conv_video_stabilization,
+ },
+ {
+ CONFIGURE_TYPE_CTRL,
+ CONFIGURE_CATEGORY_CTRL_CAMERA,
+ MM_CAM_VIDEO_WIDTH,
+ MM_CAM_VIDEO_HEIGHT,
+ "VideoResolution",
+ MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY,
+ NULL,
}
};
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
info = hcamcorder->caminfo_convert;
-
+
for( i = 0 ; i < size ; i++ )
{
if( info[i].attr_idx == attr_idx )
int i = 0;
int valid_count = 0;
int new_default = _MMCAMCORDER_SENSOR_ENUM_NONE;
-
- for (i = 0; i < original_count; i++)
- {
- if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE)
+
+ for (i = 0; i < original_count; i++) {
+ if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE) {
valid_count++;
+ }
}
- if (valid_count > 0)
- {
+ if (valid_count > 0) {
*valid_array = (int*)malloc(sizeof(int) * valid_count);
valid_count = 0;
- for (i = 0; i < original_count; i++)
- {
- if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE)
- {
+ for (i = 0; i < original_count; i++) {
+ if (original_array[i] != _MMCAMCORDER_SENSOR_ENUM_NONE) {
(*valid_array)[valid_count++] = i;
//_mmcam_dbg_log( "valid_array[%d] = %d", valid_count-1, (*valid_array)[valid_count-1] );
- if( original_array[i] == *valid_default )
- {
+ if (original_array[i] == *valid_default &&
+ new_default == _MMCAMCORDER_SENSOR_ENUM_NONE) {
new_default = i;
//_mmcam_dbg_log( "converted MSL default[%d]", new_default );
}
}
- }
+ }
}
- if( new_default != _MMCAMCORDER_SENSOR_ENUM_NONE )
- {
+ if (new_default != _MMCAMCORDER_SENSOR_ENUM_NONE) {
*valid_default = new_default;
}
info = g_display_info;
table_size = sizeof(g_display_info) / sizeof(_MMCamcorderInfoConverting);
ret = __mmcamcorder_set_info_to_attr( handle, info, table_size );
+
_mmcam_dbg_log( "result: %x", ret );
return ret;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
MMHandleType attrs = 0;
- int i;
+ int i = 0;
+ int ret = MM_ERROR_NONE;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
for (i = 0; i < table_size ; i++ )
{
- int ret = MM_ERROR_NONE;
-
/*
_mmcam_dbg_log( "%d,%d,%d,%d,%s,%d",
info[i].type,
if( info[i].type == CONFIGURE_TYPE_MAIN )
{
conf_info = hcamcorder->conf_main;
- _mmcam_dbg_log( "MAIN configure [%s]", info[i].keyword );
+ /*_mmcam_dbg_log( "MAIN configure [%s]", info[i].keyword );*/
}
else
{
conf_info = hcamcorder->conf_ctrl;
- _mmcam_dbg_log( "CTRL configure [%s]", info[i].keyword );
+ /*_mmcam_dbg_log( "CTRL configure [%s]", info[i].keyword );*/
}
switch(info[i].conv_type)
{
case MM_CAMCONVERT_TYPE_INT:
{
- int iarray = (int)NULL;
+ int ivalue = 0;
- if (!_mmcamcorder_conf_get_value_int( conf_info, info[i].category, info[i].keyword, &iarray ))
+ if (!_mmcamcorder_conf_get_value_int(handle, conf_info, info[i].category, info[i].keyword, &ivalue))
{
ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
break; //skip to set
}
- ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, iarray);
-
- //_mmcam_dbg_log("INT . m:%d, s:%d, arr=%d", info[i].main_key, info[i].sub_key1, iarray);
+ ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, ivalue);
break;
}
case MM_CAMCONVERT_TYPE_INT_ARRAY:
if( tarray )
{
idefault = tarray->default_value;
-
+
if( info[i].enum_convert )
{
iarray_size = __mmcamcorder_get_valid_array(tarray->value, tarray->count, &iarray, &idefault);
if( iarray_size > 0 )
{
/*
- _mmcam_dbg_log("INT Array. m:%d, s:%d, arr=%x, size=%d, default=%d",
- info[i].main_key, info[i].sub_key1, iarray, iarray_size, idefault);
+ _mmcam_dbg_log("INT Array. attr idx=%d array=%p, size=%d, default=%d",
+ info[i].attr_idx, iarray, iarray_size, idefault);
*/
-
- mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
- mmf_attrs_set_valid_array(attrs, info[i].attr_idx, iarray, iarray_size, idefault);
+
+ /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+ //mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
+ mmf_attrs_set_valid_array(attrs, info[i].attr_idx, iarray, iarray_size, idefault);
}
ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, idefault);
if( irange )
{
//_mmcam_dbg_log("INT Range. m:%d, s:%d, min=%d, max=%d", info[i].main_key, info[i].sub_key1, irange->min, irange->max);
-
- mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_RANGE);
+ /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+ //mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_RANGE);
mmf_attrs_set_valid_range(attrs, info[i].attr_idx, irange->min, irange->max, irange->default_value);
ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, irange->default_value);
}
case MM_CAMCONVERT_TYPE_STRING:
{
- char* cString = NULL;
+ const char *cString = NULL;
unsigned int iString_len = 0;
- if (!_mmcamcorder_conf_get_value_string(conf_info, info[i].category, info[i].keyword, &cString ))
+ if (!_mmcamcorder_conf_get_value_string(handle, conf_info, info[i].category, info[i].keyword, &cString ))
{
ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
break; //skip to set
{
type_int_pair_array *pair_array = NULL;
- //_mmcam_dbg_log("INT PAIR Array. type:%d, attr_idx:%d, attr_idx_pair:%d", info[i].type, info[i].attr_idx, info[i].attr_idx_pair);
+ /*_mmcam_dbg_log("INT PAIR Array. type:%d, attr_idx:%d, attr_idx_pair:%d", info[i].type, info[i].attr_idx, info[i].attr_idx_pair);*/
if (!_mmcamcorder_conf_get_value_int_pair_array(conf_info, info[i].category, info[i].keyword, &pair_array))
{
if( pair_array && pair_array->count > 0 )
{
- mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
+ /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+ //mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY);
mmf_attrs_set_valid_array(attrs, info[i].attr_idx,
pair_array->value[0],
pair_array->count,
pair_array->default_value[0]);
- mmf_attrs_set_valid_type(attrs, info[i].attr_idx_pair, MM_ATTRS_VALID_TYPE_INT_ARRAY);
+ /* "mmf_attrs_set_valid_type" initializes spec value in attribute, so allocated memory could be missed */
+ //mmf_attrs_set_valid_type(attrs, info[i].attr_idx_pair, MM_ATTRS_VALID_TYPE_INT_ARRAY);
mmf_attrs_set_valid_array(attrs, info[i].attr_idx_pair,
pair_array->value[1],
pair_array->count,
_mmcam_dbg_log("default : s:%d", info[i].attr_idx);
break;
}
-
- if (ret != MM_ERROR_NONE)
- {
- _mmcam_dbg_warn("Setting error. ( s:%d, ret:%x)", info[i].attr_idx, ret);
- }
}
- if (mmf_attrs_commit(attrs) == -1)
+ if (ret != MM_ERROR_NONE || mmf_attrs_commit(attrs) == -1)
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
- else
+ else
return MM_ERROR_NONE;
}
memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]), &_mmcamcorder_enum_conv_ae_type, enum_conv_size);
memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]), &_mmcamcorder_enum_conv_strobe_mode, enum_conv_size);
memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_WDR]), &_mmcamcorder_enum_conv_wdr_ctrl, enum_conv_size);
+ memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]), &_mmcamcorder_enum_conv_flip_ctrl, enum_conv_size);
+ memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]), &_mmcamcorder_enum_conv_rotation_ctrl, enum_conv_size);
memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]), &_mmcamcorder_enum_conv_ahs, enum_conv_size);
memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]), &_mmcamcorder_enum_conv_video_stabilization, enum_conv_size);
_mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]));
_mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]));
_mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]));
+ _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]));
+ _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]));
_mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]));
_mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_VIDEO_STABILIZATION]));
hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]);
} else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "WDR")) {
hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]);
+ } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "Flip")) {
+ hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_FLIP]);
+ } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "Rotation")) {
+ hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ROTATION]);
}
break;
case CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH:
=======================================================================================*/
#include <mm_sound.h>
#include <mm_sound_private.h>
-#include <avsystem.h>
#include <audio-session-manager.h>
#include "mm_camcorder_internal.h"
#include "mm_camcorder_sound.h"
/*---------------------------------------------------------------------------------------
| LOCAL VARIABLE DEFINITIONS for internal |
---------------------------------------------------------------------------------------*/
-#define SAMPLE_SOUND_NAME "camera-shutter"
#define SAMPLE_SOUND_RATE 44100
-#define DEFAULT_ACTIVE_DEVICE -1
-
-enum {
- SOUND_DEVICE_TYPE_SPEAKER, /* AVSYS_AUDIO_LVOL_DEV_TYPE_SPK */
- SOUND_DEVICE_TYPE_HEADSET, /* AVSYS_AUDIO_LVOL_DEV_TYPE_HEADSET */
- SOUND_DEVICE_TYPE_BTHEADSET, /* AVSYS_AUDIO_LVOL_DEV_TYPE_BTHEADSET */
- SOUND_DEVICE_TYPE_NUM /* AVSYS_AUDIO_LVOL_DEV_TYPE_MAX */
-};
+#define DEFAULT_ACTIVE_DEVICE 0xffffffff
/*---------------------------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
---------------------------------------------------------------------------------------*/
static void __solo_sound_callback(void *data);
+static void __pulseaudio_play_sample_cb(pa_context *pulse_context, uint32_t stream_index, void *user_data)
+{
+ SOUND_INFO *info = NULL;
+
+ mmf_return_if_fail(user_data);
+
+ info = (SOUND_INFO *)user_data;
+
+ _mmcam_dbg_log("START - idx : %d", stream_index);
+
+ pa_threaded_mainloop_signal(info->pulse_mainloop, 0);
+
+ _mmcam_dbg_log("DONE");
+
+ return;
+}
static void __pulseaudio_context_state_cb(pa_context *pulse_context, void *user_data)
{
}
_mmcam_dbg_log("DONE read_length %d", read_length);
+
+ return;
}
pa_threaded_mainloop_signal(info->pulse_mainloop, 0);
_mmcam_dbg_log("DONE");
+
+ return;
}
#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
mm_sound_device_in device_in;
mm_sound_device_out device_out;
pa_mainloop_api *api = NULL;
+ int error = PA_ERR_INTERNAL;
mmf_return_val_if_fail(hcamcorder, FALSE);
NULL);
_mmcam_dbg_log("Capture sound enable %d", sound_enable);
if (!sound_enable) {
- return TRUE;
+ _mmcam_dbg_warn("capture sound disabled");
+ return FALSE;
}
info = &(hcamcorder->snd_info);
}
#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
- if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
- int errorcode;
- ASM_resource_t mm_resource = mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-
- /* set EXCLUSIVE session as PLAYING to pause other session */
- if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
- ASM_STATE_PLAYING, mm_resource, &errorcode)) {
- _mmcam_dbg_err("Set state to playing failed 0x%x", errorcode);
- ret = MM_ERROR_POLICY_BLOCKED;
- goto SOUND_INIT_ERROR;
- }
-
- _mmcam_dbg_log("EXCLUSIVE session PLAYING done.");
- } else {
- _mmcam_dbg_log("do not register session to pause another playing session");
- }
-
/**
* Init Pulseaudio thread
*/
/* create pulseaudio mainloop */
info->pulse_mainloop = pa_threaded_mainloop_new();
+ if (info->pulse_mainloop == NULL) {
+ _mmcam_dbg_err("pa_threaded_mainloop_new failed");
+ goto SOUND_INIT_ERROR;
+ }
+
+ /* start PA mainloop */
ret = pa_threaded_mainloop_start(info->pulse_mainloop);
+ if (ret < 0) {
+ _mmcam_dbg_err("pa_threaded_mainloop_start failed");
+ goto SOUND_INIT_ERROR;
+ }
/* lock pulseaudio thread */
pa_threaded_mainloop_lock(info->pulse_mainloop);
+
/* get pulseaudio api */
api = pa_threaded_mainloop_get_api(info->pulse_mainloop);
+ if (api == NULL) {
+ _mmcam_dbg_err("pa_threaded_mainloop_get_api failed");
+ pa_threaded_mainloop_unlock(info->pulse_mainloop);
+ goto SOUND_INIT_ERROR;
+ }
+
/* create pulseaudio context */
info->pulse_context = pa_context_new(api, NULL);
+ if (info->pulse_context == NULL) {
+ _mmcam_dbg_err("pa_context_new failed");
+ pa_threaded_mainloop_unlock(info->pulse_mainloop);
+ goto SOUND_INIT_ERROR;
+ }
+
/* set pulseaudio context callback */
pa_context_set_state_callback(info->pulse_context, __pulseaudio_context_state_cb, info);
/* wait for upload completion */
pa_threaded_mainloop_wait(info->pulse_mainloop);
- pa_threaded_mainloop_unlock (info->pulse_mainloop);
+ pa_threaded_mainloop_unlock(info->pulse_mainloop);
/* close sndfile */
sf_close(info->infile);
info->infile = NULL;
-#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+ if (info->sample_stream) {
+ pa_stream_connect_playback(info->sample_stream, NULL, NULL, 0, NULL, NULL);
- if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
- /* backup current route */
- info->active_out_backup = DEFAULT_ACTIVE_DEVICE;
+ for (;;) {
+ pa_stream_state_t state = pa_stream_get_state(info->sample_stream);
- __ta__(" mm_sound_get_active_device",
- ret = mm_sound_get_active_device(&device_in, &device_out);
- );
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret);
- goto SOUND_INIT_ERROR;
+ if (state == PA_STREAM_READY) {
+ _mmcam_dbg_warn("device READY done");
+ break;
+ }
+
+ if (!PA_STREAM_IS_GOOD(state)) {
+ error = pa_context_errno(info->pulse_context);
+ _mmcam_dbg_err("pa context state is not good, %d", error);
+ break;
+ }
+
+ /* Wait until the stream is ready */
+ pa_threaded_mainloop_wait(info->pulse_mainloop);
}
+ }
+#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
- _mmcam_dbg_log("current out [%x]", device_out);
+ /* backup current route */
+ info->active_out_backup = DEFAULT_ACTIVE_DEVICE;
- if (device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
- ret = mm_sound_set_active_route (MM_SOUND_ROUTE_OUT_SPEAKER);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_set_active_route failed [%x]. skip sound play.", ret);
- goto SOUND_INIT_ERROR;
- }
- info->active_out_backup = device_out;
+ ret = mm_sound_get_active_device(&device_in, &device_out);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret);
+ goto SOUND_INIT_ERROR;
+ }
+
+ _mmcam_dbg_log("current out [%x]", device_out);
+
+ if (device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
+ //ret = mm_sound_set_active_route_without_broadcast (MM_SOUND_ROUTE_OUT_SPEAKER);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("mm_sound_set_active_route_without_broadcast failed [%x]. skip sound play.", ret);
+ goto SOUND_INIT_ERROR;
}
+ info->active_out_backup = device_out;
}
+ //info->volume_type = PA_TIZEN_AUDIO_VOLUME_TYPE_FIXED;
+ info->volume_level = 0;
+
info->state = _MMCAMCORDER_SOUND_STATE_INIT;
_mmcam_dbg_log("init DONE");
/* remove pulse mainloop */
if (info->pulse_mainloop) {
+ pa_threaded_mainloop_lock(info->pulse_mainloop);
+
/* remove pulse context */
if (info->pulse_context) {
#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
/* Wait for async operation */
pa_threaded_mainloop_wait(info->pulse_mainloop);
}
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+ /* release sample stream */
+ if (info->sample_stream) {
+ pa_stream_disconnect(info->sample_stream);
+ pa_stream_unref(info->sample_stream);
+ info->sample_stream = NULL;
+ }
#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
/* Make sure we don't get any further callbacks */
info->pulse_context = NULL;
}
+ pa_threaded_mainloop_unlock(info->pulse_mainloop);
+
pa_threaded_mainloop_stop(info->pulse_mainloop);
pa_threaded_mainloop_free(info->pulse_mainloop);
info->pulse_mainloop = NULL;
}
-gboolean _mmcamcorder_sound_play(MMHandleType handle)
+gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, gboolean sync_play)
{
- int ret = 0;
int sound_enable = TRUE;
- int volume_type = AVSYS_AUDIO_VOLUME_TYPE_FIXED;
- int device_type = SOUND_DEVICE_TYPE_SPEAKER;
- int left_volume = 0, right_volume = 0;
- float left_gain = 1.0f, right_gain = 1.0f;
- int set_volume = 0;
- int max_level = 0;
- unsigned int volume_level;
+ int gain_type = VOLUME_GAIN_SHUTTER1;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
SOUND_INFO *info = NULL;
pa_operation *pulse_op = NULL;
- mmf_return_val_if_fail(hcamcorder, FALSE);
+ mmf_return_val_if_fail(hcamcorder && sample_name, FALSE);
/* check sound play enable */
- ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
- "capture-sound-enable", &sound_enable,
- NULL);
+ mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+ "capture-sound-enable", &sound_enable,
+ NULL);
_mmcam_dbg_log("Capture sound enable %d", sound_enable);
if (!sound_enable) {
- return TRUE;
+ _mmcam_dbg_warn("capture sound disabled");
+ return FALSE;
}
info = &(hcamcorder->snd_info);
return FALSE;
}
- /* get volume level and set volume */
- if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_OFF) {
- gboolean sound_status = hcamcorder->sub_context->info_image->sound_status;
- mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
- mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
-
- volume_type = AVSYS_AUDIO_VOLUME_TYPE_MEDIA;
- avsys_audio_get_volume_max_ex(volume_type, &max_level);
-
- /* get sound path */
- __ta__(" mm_sound_get_active_device",
- mm_sound_get_active_device(&device_in, &device_out);
- );
-
- _mmcam_dbg_log("sound status %d, device out %x", sound_status, device_out);
+ if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE)) {
+ gain_type = VOLUME_GAIN_SHUTTER2;
+ } else if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP)) {
+ gain_type = VOLUME_GAIN_CAMCORDING;
+ }
- if (device_out == MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY) {
- device_type = SOUND_DEVICE_TYPE_HEADSET;
- } else if (device_out == MM_SOUND_DEVICE_OUT_BT_A2DP) {
- device_type = SOUND_DEVICE_TYPE_BTHEADSET;
- }
+ _mmcam_dbg_log("Play start - sample name [%s]", sample_name);
- if (sound_status || device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
- volume_level = hcamcorder->sub_context->info_image->volume_level;
- _mmcam_dbg_log("current volume level %d", volume_level);
- } else {
- volume_level = 0;
- _mmcam_dbg_log("current state is SILENT mode and SPEAKER output");
- }
+ if (sync_play) {
+ pa_threaded_mainloop_lock(info->pulse_mainloop);
+/*
+ pulse_op = pa_ext_policy_play_sample(info->pulse_context,
+ sample_name,
+ info->volume_type,
+ gain_type,
+ info->volume_level,
+ __pulseaudio_play_sample_cb,
+ info);
+*/
+ _mmcam_dbg_log("wait for signal");
+ pa_threaded_mainloop_wait(info->pulse_mainloop);
+ _mmcam_dbg_log("received signal");
- if (volume_level > (unsigned int)max_level) {
- _mmcam_dbg_warn("invalid volume level. set max");
- volume_level = (unsigned int)max_level;
- }
+ pa_threaded_mainloop_unlock(info->pulse_mainloop);
} else {
- avsys_audio_get_volume_max_ex(volume_type, &max_level);
- volume_level = (unsigned int)max_level;
+/*
+ pulse_op = pa_ext_policy_play_sample(info->pulse_context,
+ sample_name,
+ info->volume_type,
+ gain_type,
+ info->volume_level,
+ NULL,
+ NULL);
+*/
}
-
- avsys_audio_get_volume_table(volume_type, device_type, (int)volume_level, &left_volume, &right_volume);
- avsys_audio_get_volume_gain_table(
- AVSYS_AUDIO_VOLUME_GAIN_IDX(AVSYS_AUDIO_VOLUME_GAIN_SHUTTER2),
- device_type, &left_gain, &right_gain);
- set_volume = left_volume * left_gain;
- _mmcam_dbg_log("volume type %d, device type %d, volume level %d, left volume %d left gain %.2f set_volume %d",
- volume_type, device_type, volume_level, left_volume, left_gain, set_volume);
-
- _mmcam_dbg_log("shutter sound policy %d, volume %d",
- hcamcorder->shutter_sound_policy, set_volume);
-
- _mmcam_dbg_log("Play start");
-
- __ta__(" pa_context_play_sample",
- pulse_op = pa_context_play_sample(info->pulse_context,
- SAMPLE_SOUND_NAME,
- NULL,
- set_volume,
- NULL,
- NULL);
- );
if (pulse_op) {
pa_operation_unref(pulse_op);
pulse_op = NULL;
return TRUE;
}
- if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
- /**
- * Restore route
- */
- _mmcam_dbg_log("restore route");
- if (info->active_out_backup != DEFAULT_ACTIVE_DEVICE) {
- ret = mm_sound_get_active_device(&device_in, &device_out);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret);
- }
+ /* Restore route */
+ _mmcam_dbg_log("restore route");
+ if (info->active_out_backup != DEFAULT_ACTIVE_DEVICE) {
+ ret = mm_sound_get_active_device(&device_in, &device_out);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("mm_sound_get_active_device failed [%x]", ret);
+ }
- _mmcam_dbg_log("current out [%x]", device_out);
+ _mmcam_dbg_log("current out [%x]", device_out);
- if (device_out != info->active_out_backup) {
- ret = mm_sound_set_active_route (info->active_out_backup);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_set_active_route failed [%x]. skip sound play.", ret);
- }
+ if (device_out != info->active_out_backup) {
+ //ret = mm_sound_set_active_route_without_broadcast (info->active_out_backup);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("mm_sound_set_active_route_without_broadcast [%x]", ret);
}
}
}
+ pa_threaded_mainloop_lock(info->pulse_mainloop);
+
#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
/**
* Remove sample
*/
_mmcam_dbg_log("remove sample");
- pa_threaded_mainloop_lock(info->pulse_mainloop);
-
/* Remove sample (ASYNC) */
pa_operation_unref(pa_context_remove_sample(info->pulse_context, SAMPLE_SOUND_NAME, __pulseaudio_remove_sample_finish_cb, info));
/* Wait for async operation */
pa_threaded_mainloop_wait(info->pulse_mainloop);
-
- pa_threaded_mainloop_unlock(info->pulse_mainloop);
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+ if (info->sample_stream) {
+ pa_stream_disconnect(info->sample_stream);
+ pa_stream_unref(info->sample_stream);
+ info->sample_stream = NULL;
+ }
#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
/**
*/
_mmcam_dbg_log("release pulseaudio thread");
- pa_threaded_mainloop_lock(info->pulse_mainloop);
-
pa_context_disconnect(info->pulse_context);
/* Make sure we don't get any further callbacks */
pthread_mutex_destroy(&(info->play_mutex));
pthread_cond_destroy(&(info->play_cond));
- if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
- int errorcode = 0;
- ASM_resource_t mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER;
-
- /* stop EXCLUSIVE session */
- if (!ASM_set_sound_state(hcamcorder->asm_handle_ex, ASM_EVENT_EXCLUSIVE_MMCAMCORDER,
- ASM_STATE_STOP, mm_resource, &errorcode)) {
- _mmcam_dbg_err("EXCLUSIVE Set state to STOP failed 0x%x", errorcode);
- } else {
- _mmcam_dbg_log("EXCLUSIVE session STOP done.");
- }
- }
-
pthread_mutex_unlock(&(info->open_mutex));
_mmcam_dbg_err("DONE");
}
-gboolean _mmcamcorder_sound_capture_play_cb(gpointer data)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data);
-
- mmf_return_val_if_fail(hcamcorder, FALSE);
-
- _mmcam_dbg_log("Capture sound PLAY in idle callback");
-
- _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
-
- return FALSE;
-}
-
-
-void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gboolean sync)
+void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gboolean sync_play)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
int sound_handle = 0;
int ret = MM_ERROR_NONE;
int sound_enable = TRUE;
+ int sound_played = FALSE;
int gain_type = VOLUME_GAIN_SHUTTER1;
mmf_return_if_fail(filepath && hcamcorder);
_mmcam_dbg_log("START : %s", filepath);
- ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
- "capture-sound-enable", &sound_enable,
- NULL);
- _mmcam_dbg_log("Capture sound enable %d", sound_enable);
- if (!sound_enable) {
- return;
- }
+ _mmcamcorder_sound_solo_play_wait(handle);
ret = pthread_mutex_trylock(&(hcamcorder->sound_lock));
if (ret != 0) {
}
/* check filename to set gain_type */
- if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_CAPTURE_SND)) {
- gain_type = VOLUME_GAIN_SHUTTER1;
+ if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_CAPTURE_SND) ||
+ !strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_START_SND)) {
+ if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_START_SND)) {
+ gain_type = VOLUME_GAIN_CAMCORDING;
+ } else {
+ gain_type = VOLUME_GAIN_SHUTTER1;
+ }
} else if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_CAPTURE2_SND)) {
gain_type = VOLUME_GAIN_SHUTTER2;
- } else if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_START_SND) ||
- !strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_STOP_SND)) {
+ } else if (!strcmp(filepath, _MMCAMCORDER_FILEPATH_REC_STOP_SND)) {
gain_type = VOLUME_GAIN_CAMCORDING;
}
_mmcam_dbg_log("gain type 0x%x", gain_type);
- if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON) {
- __ta__("CAPTURE SOUND:mm_sound_play_loud_solo_sound",
- ret = mm_sound_play_loud_solo_sound(filepath, VOLUME_TYPE_FIXED | gain_type,
- __solo_sound_callback, (void*)hcamcorder, &sound_handle);
- );
- } else {
- gboolean sound_status = hcamcorder->sub_context->info_image->sound_status;
- mm_sound_device_in device_in;
- mm_sound_device_out device_out;
+ ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+ "capture-sound-enable", &sound_enable,
+ NULL);
+ _mmcam_dbg_log("Capture sound enable %d", sound_enable);
- /* get sound path */
- mm_sound_get_active_device(&device_in, &device_out);
+ if (!sound_enable) {
+ /* send capture sound completed message */
+ pthread_mutex_unlock(&(hcamcorder->sound_lock));
+ return;
+ }
- _mmcam_dbg_log("sound status %d, device out %x", sound_status, device_out);
- if (sound_status || device_out != MM_SOUND_DEVICE_OUT_SPEAKER) {
- __ta__("CAPTURE SOUND:mm_sound_play_sound",
- ret = mm_sound_play_sound(filepath, VOLUME_TYPE_MEDIA | gain_type,
- __solo_sound_callback, (void*)hcamcorder, &sound_handle);
- );
- }
+ if (hcamcorder->shutter_sound_policy == VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY_ON ||
+ hcamcorder->sub_context->info_image->sound_status) {
+ ret = mm_sound_play_loud_solo_sound(filepath, VOLUME_TYPE_FIXED | gain_type,
+ (mm_sound_stop_callback_func)__solo_sound_callback, (void*)hcamcorder, &sound_handle);
+ sound_played = TRUE;
+ } else {
+ _mmcam_dbg_warn("skip shutter sound");
}
+
+ _mmcam_dbg_log("sync_play %d, sound_played %d, ret 0x%x", sync_play, sound_played, ret);
+
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_err( "Capture sound play FAILED.[%x]", ret );
} else {
- if (sync) {
+ if (sound_played) {
+ /* increase capture sound count */
+ hcamcorder->capture_sound_count++;
+ }
+
+ /* wait for sound completed signal */
+ if (sync_play && sound_played) {
struct timespec timeout;
struct timeval tv;
_mmcam_dbg_log("Wait for signal");
- MMTA_ACUM_ITEM_BEGIN("CAPTURE SOUND:wait sound play finish", FALSE);
-
if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) {
_mmcam_dbg_log("signal received.");
} else {
mm_sound_stop_sound(sound_handle);
}
}
-
- MMTA_ACUM_ITEM_END("CAPTURE SOUND:wait sound play finish", FALSE);
}
}
_mmcam_dbg_log("START");
+ /* decrease capture sound count */
+ pthread_mutex_lock(&(hcamcorder->sound_lock));
+ if (hcamcorder->capture_sound_count > 0) {
+ hcamcorder->capture_sound_count--;
+ } else {
+ _mmcam_dbg_warn("invalid capture_sound_count %d, reset count", hcamcorder->capture_sound_count);
+ hcamcorder->capture_sound_count = 0;
+ }
+ pthread_mutex_unlock(&(hcamcorder->sound_lock));
+
_mmcam_dbg_log("Signal SEND");
pthread_cond_broadcast(&(hcamcorder->sound_cond));
return;
}
+
+void _mmcamcorder_sound_solo_play_wait(MMHandleType handle)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ mmf_return_if_fail(hcamcorder);
+
+ _mmcam_dbg_log("START");
+
+ /* check playing sound count */
+ pthread_mutex_lock(&(hcamcorder->sound_lock));
+ if (hcamcorder->capture_sound_count > 0) {
+ struct timespec timeout;
+ struct timeval tv;
+
+ gettimeofday( &tv, NULL );
+ timeout.tv_sec = tv.tv_sec + 2;
+ timeout.tv_nsec = tv.tv_usec * 1000;
+
+ _mmcam_dbg_log("Wait for signal");
+
+ if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) {
+ _mmcam_dbg_log("signal received.");
+ } else {
+ _mmcam_dbg_warn("capture sound play timeout.");
+ }
+ } else {
+ _mmcam_dbg_warn("no playing sound - count %d", hcamcorder->capture_sound_count);
+ }
+ pthread_mutex_unlock(&(hcamcorder->sound_lock));
+
+ _mmcam_dbg_log("DONE");
+
+ return;
+}
#include "mm_camcorder_stillshot.h"
#include "mm_camcorder_exifinfo.h"
#include "mm_camcorder_exifdef.h"
+#include <libexif/exif-loader.h>
+#include <libexif/exif-utils.h>
+#include <libexif/exif-data.h>
/*---------------------------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS for internal |
---------------------------------------------------------------------------------------*/
#define EXIF_SET_ERR( return_type,tag_id) \
_mmcam_dbg_err("error=%x,tag=%x",return_type,tag_id); \
- if (return_type == MM_ERROR_CAMCORDER_LOW_MEMORY) { \
+ if (return_type == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) { \
goto exit; \
}
---------------------------------------------------------------------------------------*/
#define THUMBNAIL_WIDTH 320
#define THUMBNAIL_HEIGHT 240
-#define THUMBNAIL_DEFAULT_RATIO 1.34
-#define THUMBNAIL_JPEG_QUALITY 50
+#define THUMBNAIL_JPEG_QUALITY 90
#define TRY_LOCK_MAX_COUNT 100
-#define TRY_LOCK_TIME 50000 /* ms */
+#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_stop(MMHandleType handle);
static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sample1, GstSample *sample2, GstSample *sample3, gpointer u_data);
-/* Function for JPEG capture with Encode bin */
-static gboolean __mmcamcorder_encodesink_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data);
-
/* sound status changed callback */
static void __sound_status_changed_cb(keynode_t* node, void *data);
static void __volume_level_changed_cb(void* user_data);
---------------------------------------------------------------------------------------*/
-int _mmcamcorder_add_stillshot_pipeline(MMHandleType handle)
+int _mmcamcorder_create_stillshot_pipeline(MMHandleType handle)
{
int err = MM_ERROR_UNKNOWN;
-
GstPad *srcpad = NULL;
GstPad *sinkpad = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
- _MMCamcorderImageInfo *info = 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);
- info = sc->info_image;
-
_mmcam_dbg_log("");
- /* Check main pipeline */
- if (!sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
- _mmcam_dbg_err( "Main Pipeline is not existed." );
- return MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- }
-
/* Create gstreamer element */
_mmcam_dbg_log("Using Encodebin for capturing");
- __ta__(" _mmcamcorder_create_encodesink_bin",
+ /* Create capture pipeline */
+ _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "capture_pipeline", err);
+
err = _mmcamcorder_create_encodesink_bin((MMHandleType)hcamcorder, MM_CAMCORDER_ENCBIN_PROFILE_IMAGE);
- );
if (err != MM_ERROR_NONE) {
return err;
}
- gst_bin_add_many(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst,
+ /* add element and encodesink bin to encode main pipeline */
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst,
NULL);
- /* Link each element */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
- _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, element_link_error)
+ /* Link each element : appsrc - capsfilter - encodesink bin */
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "sink");
+ _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
+ _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
- MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,
+ /* connect handoff signal to get capture data */
+ MMCAMCORDER_SIGNAL_CONNECT(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
_MMCAMCORDER_HANDLER_STILLSHOT, "handoff",
- G_CALLBACK(__mmcamcorder_encodesink_handoff_callback),
+ G_CALLBACK(__mmcamcorder_handoff_callback),
hcamcorder);
return MM_ERROR_NONE;
-element_link_error:
- _mmcam_dbg_err("Link encodebin failed!");
-
- if (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst != NULL) {
- int ret = MM_ERROR_NONE;
-
- __ta__( " EncodeBin Set NULL",
- ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, GST_STATE_NULL);
- );
- _mmcam_dbg_log("encodebin _mmcamcorder_gst_set_state NULL ret[%d]", ret);
-
- gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
-
- _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
-
- _mmcam_dbg_log("Encodebin removed");
- }
-
- return MM_ERROR_CAMCORDER_GST_LINK;
+pipeline_creation_error:
+ _mmcamcorder_remove_stillshot_pipeline(handle);
+ return err;
}
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- /*set video source element*/
+ /* check video source element */
if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "signal-still-capture", TRUE);
-
+ _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);
+
return MM_ERROR_NONE;
} else {
_mmcam_dbg_err("videosrc element is not created yet");
int _mmcamcorder_remove_stillshot_pipeline(MMHandleType handle)
{
+ int ret = MM_ERROR_NONE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
- _MMCamcorderImageInfo *info = 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);
- info = sc->info_image;
-
_mmcam_dbg_log("");
/* Check pipeline */
- if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
- _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_STILLSHOT);
+ 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);
+ return ret;
+ }
- if (sc->bencbin_capture) {
- GstPad *srcpad = NULL, *sinkpad = NULL;
- if (!sc->element[_MMCAMCORDER_ENCSINK_BIN].gst) {
- _mmcam_dbg_log("ENCSINK_BIN is already removed");
- } else {
- /* Unlink each element */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
- _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
+ _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_STILLSHOT);
- gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+ GstPad *reqpad = NULL;
- _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
- }
+ /* release request pad */
+ reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
+ if (reqpad) {
+ gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+ gst_object_unref(reqpad);
+ reqpad = NULL;
}
+
+ /* release encode main pipeline */
+ gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
+
+ _mmcam_dbg_log("Encoder pipeline removed");
} else {
- _mmcam_dbg_log("MAIN_PIPE is already removed");
+ _mmcam_dbg_log("encode main pipeline is already removed");
}
return MM_ERROR_NONE;
void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle)
{
- GstPad *reqpad1 = NULL;
- GstPad *reqpad2 = NULL;
-
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
_mmcam_dbg_log("");
if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+ 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);
+
_mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_NULL);
_mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_CATEGORY_ALL);
- reqpad1 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src0");
- reqpad2 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src1");
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad1);
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad2);
- gst_object_unref(reqpad1);
- gst_object_unref(reqpad2);
-
gst_object_unref(sc->element[_MMCAMCORDER_MAIN_PIPE].gst);
/* NULL initialization will be done in _mmcamcorder_element_release_noti */
}
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;
- char *videosrc_name = NULL;
+ const char *videosrc_name = NULL;
- GstElement *pipeline = NULL;
GstCameraControl *control = NULL;
- GstCaps *caps = NULL;
- GstClock *clock = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderImageInfo *info = NULL;
_mmcam_dbg_log("");
- pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
info = sc->info_image;
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_CAPTURE,
"UseCaptureMode",
&UseCaptureMode);
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"VideosrcElement",
&VideosrcElement);
goto cmd_error;
}
- MMTA_ACUM_ITEM_BEGIN("Real First Capture Start",false);
-
/* get current state */
mm_camcorder_get_state(handle, ¤t_state);
/* set capture flag */
info->capturing = TRUE;
- mm_camcorder_get_attributes(handle, &err_name,
+ ret = mm_camcorder_get_attributes(handle, &err_name,
MMCAM_IMAGE_ENCODER, &image_encoder,
MMCAM_CAMERA_WIDTH, &width,
MMCAM_CAMERA_HEIGHT, &height,
MMCAM_CAMERA_FPS, &fps,
- MMCAM_CAMERA_HDR_CAPTURE, &info->hdr_capture_mode,
MMCAM_CAPTURE_FORMAT, &cap_format,
MMCAM_CAPTURE_WIDTH, &info->width,
MMCAM_CAPTURE_HEIGHT, &info->height,
MMCAM_CAPTURE_COUNT, &info->count,
MMCAM_CAPTURE_INTERVAL, &info->interval,
MMCAM_STROBE_MODE, &strobe_mode,
+ MMCAM_TAG_ORIENTATION, &tag_orientation,
NULL);
if (err_name) {
- _mmcam_dbg_warn("get_attributes err %s", err_name);
+ _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
free(err_name);
err_name = NULL;
}
info->multi_shot_stop = FALSE;
/* sound init to pause other session */
- __ta__(" _mmcamcorder_sound_init",
#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
_mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND);
#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
_mmcamcorder_sound_init(handle);
#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
- );
}
- _mmcam_dbg_log("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d)",
+ _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,
- info->count, info->hdr_capture_mode);
+ info->count, info->hdr_capture_mode, info->interval);
/* check state */
if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
if (info->type == _MMCamcorder_MULTI_SHOT ||
- info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF ||
- info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- _mmcam_dbg_err("not support multi/HDR capture while recording or NOT ITLV format");
+ info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF) {
+ _mmcam_dbg_err("does not support multi/HDR capture while recording");
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto cmd_error;
}
+
+ /* 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);
+
+ info->width = width;
+ info->height = height;
+
+ _mmcam_dbg_log("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);
+
+ is_modified_size = TRUE;
+ }
}
info->capture_cur_count = 0;
if (!sc->bencbin_capture) {
/* Check encoding method */
if (cap_format == MM_PIXEL_FORMAT_ENCODED) {
- if (sc->SensorEncodedCapture && info->type == _MMCamcorder_SINGLE_SHOT) {
+ if ((sc->SensorEncodedCapture && info->type == _MMCamcorder_SINGLE_SHOT) ||
+ (sc->SensorEncodedCapture && sc->info_video->support_dual_stream) ||
+ is_modified_size) {
cap_fourcc = _mmcamcorder_get_fourcc(cap_format, image_encoder, hcamcorder->use_zero_copy_format);
- _mmcam_dbg_log("Sensor JPEG Capture");
+ _mmcam_dbg_log("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) {
sc->internal_encode = TRUE;
}
-
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",
}
} else {
cap_fourcc = _mmcamcorder_get_fourcc(cap_format, MM_IMAGE_CODEC_INVALID, hcamcorder->use_zero_copy_format);
- if (info->type == _MMCamcorder_SINGLE_SHOT && !strcmp(videosrc_name, "camerasrc")) {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE );
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE );
- }
}
_mmcam_dbg_log("capture format (%d)", cap_format);
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-interval", info->interval);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-count", info->count);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", info->hdr_capture_mode);
if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_err("Can't cast Video source into camera control.");
}
}
- /* make pipeline state as READY */
- ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to set state PAUSED %x", ret);
- return ret;
- }
+ if (need_change) {
+ int rotation = 0;
- /* add encodesinkbin */
- ret = _mmcamcorder_add_stillshot_pipeline((MMHandleType)hcamcorder);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to create encodesinkbin %x", ret);
- return ret;
- }
+ _mmcam_dbg_log("Need to change resolution");
- /* set JPEG quality */
- mm_camcorder_get_attributes(handle, &err_name,
- MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality,
- NULL);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_IENC].gst, "quality", cap_jpeg_quality);
+ 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);
- if (need_change) {
- _mmcam_dbg_log("Need to change resolution");
+ /* make pipeline state as READY */
+ ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ 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);
+ return ret;
+ }
if (UseCaptureMode) {
set_width = MMFCAMCORDER_HIGHQUALITY_WIDTH;
set_height = info->height;
}
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, sc->format_name,
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- "rotate", G_TYPE_INT, 0,
- NULL);
- if (caps == NULL) {
- _mmcam_dbg_err("failed to create caps");
- ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
- goto cmd_error;
+ mm_camcorder_get_attributes(handle, &err_name,
+ MMCAM_CAMERA_ROTATION, &rotation,
+ NULL);
+ if (err_name) {
+ _mmcam_dbg_warn("get_attributes err %s", err_name);
+ free(err_name);
+ err_name = NULL;
}
- info->resolution_change = TRUE;
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
- gst_caps_unref(caps);
+ /* 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");
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
- /*MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "num-buffers", info->count);*/
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "req-negotiation",TRUE);
+ info->resolution_change = TRUE;
- /* FIXME: consider delay */
- clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
- sc->stillshot_time = gst_clock_get_time(clock) - gst_element_get_base_time(GST_ELEMENT(pipeline));
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ /* 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 PAUSED %x", ret);
+ return ret;
+ }
_mmcam_dbg_log("Change to target resolution(%d, %d)", set_width, set_height);
} else {
_mmcam_dbg_log("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);
+ return ret;
}
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst,"signal-handoffs", TRUE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ ret = mm_camcorder_get_attributes(handle, &err_name,
+ MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality,
+ NULL);
+ if (err_name) {
+ _mmcam_dbg_warn("get_attributes err %s, ret 0x%x", err_name, ret);
+ free(err_name);
+ err_name = NULL;
+ }
+
+ /* set JPEG quality */
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_IENC].gst, "quality", cap_jpeg_quality);
- /* make pipeline state as PLAYING */
- ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+ /* set handoff signal as TRUE */
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,"signal-handoffs", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+
+ /* 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);
return ret;
/* Play capture sound here if single capture */
if ((info->type == _MMCamcorder_SINGLE_SHOT &&
- (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY || strobe_mode == MM_CAMCORDER_STROBE_MODE_OFF)) ||
+ (hcamcorder->support_zsl_capture == FALSE ||
+ strobe_mode == MM_CAMCORDER_STROBE_MODE_OFF)) ||
info->hdr_capture_mode) {
- if (current_state < MM_CAMCORDER_STATE_RECORDING) {
- __ta__(" _mmcamcorder_sound_solo_play",
+ if (current_state < MM_CAMCORDER_STATE_RECORDING &&
+ hcamcorder->support_zsl_capture == TRUE &&
+ !info->hdr_capture_mode) {
_mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
- );
}
/* set flag */
int width = 0;
int height = 0;
int fps = 0;
- int cap_width = 0;
- int cap_height = 0;
int rotation = 0;
- int set_width = 0;
- int set_height = 0;
- int set_rotate = 0;
- int current_framecount = 0;
+ unsigned int current_framecount = 0;
int current_state = MM_CAMCORDER_STATE_NONE;
gboolean fps_auto = FALSE;
char *err_name = NULL;
- char *videosrc_name = NULL;
+ const char *videosrc_name = NULL;
GstState state;
- GstCaps *caps = NULL;
GstElement *pipeline = NULL;
GstCameraControl *control = NULL;
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_dbg_log("");*/
pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
info = sc->info_image;
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
-
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"VideosrcElement",
&VideosrcElement);
_mmcam_dbg_log("current state [%d]", current_state);
if (!sc->bencbin_capture) {
- _mmcam_dbg_log("Capture Preview start : avsysvideosrc - No need to set new caps.");
+ _mmcam_dbg_log("Preview start");
/* just set capture stop command if current state is CAPTURING */
if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
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);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
}
} else {
int focus_mode = 0;
+ mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
/* This case is starting of preview */
ret = mm_camcorder_get_attributes(handle, &err_name,
SAFE_FREE (err_name);
}
+ _mmcam_dbg_log("focus mode %d", focus_mode);
+
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto);
/* set focus mode */
- mm_camcorder_set_attributes(handle, NULL,
- MMCAM_CAMERA_FOCUS_MODE, focus_mode,
- NULL);
- }
- } else {
- /* check if resolution need to rollback */
- mm_camcorder_get_attributes(handle, &err_name,
- MMCAM_CAMERA_WIDTH, &width,
- MMCAM_CAMERA_HEIGHT, &height,
- MMCAM_CAMERA_FPS, &fps,
- MMCAM_CAMERA_FPS_AUTO, &fps_auto,
- MMCAM_CAMERA_ROTATION, &rotation,
- MMCAM_CAPTURE_WIDTH, &cap_width,
- MMCAM_CAPTURE_HEIGHT, &cap_height,
- NULL);
-
- if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
- switch (rotation) {
- case MM_VIDEO_INPUT_ROTATION_90:
- set_width = height;
- set_height = width;
- set_rotate = 90;
- break;
- case MM_VIDEO_INPUT_ROTATION_180:
- set_width = width;
- set_height = height;
- set_rotate = 180;
- break;
- case MM_VIDEO_INPUT_ROTATION_270:
- set_width = height;
- set_height = width;
- set_rotate = 270;
- break;
- case MM_VIDEO_INPUT_ROTATION_NONE:
- default:
- set_width = width;
- set_height = height;
- set_rotate = 0;
- break;
- }
-
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, sc->format_name,
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT,set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- "rotate", G_TYPE_INT, set_rotate,
- NULL);
- if (caps != NULL) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
- gst_caps_unref(caps);
- _mmcam_dbg_log("Rollback to original resolution(%d, %d)", width, height);
+ if (attr) {
+ if (_mmcamcorder_check_supported_attribute(handle, MM_CAM_CAMERA_FOCUS_MODE)) {
+ mmf_attribute_set_modified(&(attr->items[MM_CAM_CAMERA_FOCUS_MODE]));
+ if (mmf_attrs_commit((MMHandleType)attr) == -1) {
+ _mmcam_dbg_err("set focus mode error");
+ } else {
+ _mmcam_dbg_log("set focus mode success");
+ }
+ } else {
+ _mmcam_dbg_log("focus mode is not supported");
+ }
} else {
- _mmcam_dbg_err("failed to create caps");
- ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
- goto cmd_error;
+ _mmcam_dbg_err("failed to get attributes");
}
}
}
+ /* init prev_time */
+ sc->info_video->prev_preview_ts = 0;
+
gst_element_get_state(pipeline, &state, NULL, -1);
if (state == GST_STATE_PLAYING) {
- if (!strcmp(videosrc_name, "avsysvideosrc") || !strcmp(videosrc_name, "camerasrc")) {
+ if (!sc->bencbin_capture) {
int try_count = 0;
- if (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
+ if (hcamcorder->support_zsl_capture == FALSE) {
mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
/* Set strobe mode - strobe mode can not be set to driver while captuing */
if (attr) {
- __ta__(" Set strobe mode after capture",
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");
}
- );
}
- __ta__(" Wait preview frame after capture",
while (current_framecount >= sc->kpi.video_framecount &&
try_count++ < _MMCAMCORDER_CAPTURE_STOP_CHECK_COUNT) {
usleep(_MMCAMCORDER_CAPTURE_STOP_CHECK_INTERVAL);
}
- );
}
if (info->type == _MMCamcorder_MULTI_SHOT) {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ 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]",
current_framecount, sc->kpi.video_framecount, try_count);
} else {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
+ ret = _mmcamcorder_remove_stillshot_pipeline(handle);
if (ret != MM_ERROR_NONE) {
goto cmd_error;
}
- /* remove handoff signal handler */
- _mmcamcorder_remove_all_handlers(handle, _MMCAMCORDER_HANDLER_STILLSHOT);
-
- /* remove encodesinkbin after capture */
- if (!sc->element[_MMCAMCORDER_ENCSINK_BIN].gst) {
- _mmcam_dbg_log("ENCSINK_BIN is already removed");
- } else {
- GstPad *reqpad0 = NULL;
- GstPad *srcpad = NULL;
- GstPad *sinkpad = NULL;
-
- /* release requested pad */
- reqpad0 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "image");
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad0);
- gst_object_unref(reqpad0);
-
- /* Unlink each element */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "image_sink0");
- _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
-
- /* make state of encodesinkbin as NULL */
- _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, GST_STATE_NULL);
-
- gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+ if (info->resolution_change) {
+ 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);
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ if (ret != MM_ERROR_NONE) {
+ goto cmd_error;
+ }
- _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
- }
+ /* check if resolution need to rollback */
+ mm_camcorder_get_attributes(handle, &err_name,
+ MMCAM_CAMERA_WIDTH, &width,
+ MMCAM_CAMERA_HEIGHT, &height,
+ MMCAM_CAMERA_FPS, &fps,
+ MMCAM_CAMERA_ROTATION, &rotation,
+ NULL);
+
+ /* 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");
+ ret = MM_ERROR_CAMCORDER_INTERNAL;
+ goto cmd_error;
+ }
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- if (ret != MM_ERROR_NONE) {
- goto cmd_error;
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+ if (ret != MM_ERROR_NONE) {
+ goto cmd_error;
+ }
}
}
/* sound finalize */
if (info->type == _MMCamcorder_MULTI_SHOT) {
- __ta__(" _mmcamcorder_sound_finalize",
_mmcamcorder_sound_finalize(handle);
- );
}
} else {
- int cap_count = 0;
- int sound_ret = FALSE;
+ 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);
+ }
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
- __ta__(" _MMCamcorder_CMD_PREVIEW_START:GST_STATE_PLAYING",
ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- );
if (ret != MM_ERROR_NONE) {
goto cmd_error;
}
_mmcam_dbg_log("get sound status/volume level and register vconf changed_cb");
/* get sound status */
- __ta__(" GET:VCONFKEY_SETAPPL_SOUND_STATUS_BOOL",
vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status));
- );
_mmcam_dbg_log("sound status %d", info->sound_status);
/* get volume level */
- __ta__(" mm_sound_volume_get_value",
- mm_sound_volume_get_value(VOLUME_TYPE_MEDIA, &info->volume_level);
- );
+ mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &info->volume_level);
_mmcam_dbg_log("volume level %d", info->volume_level);
/* register changed_cb */
vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb, hcamcorder);
- mm_sound_volume_add_callback(VOLUME_TYPE_MEDIA, __volume_level_changed_cb, hcamcorder);
- }
-
- mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_COUNT, &cap_count, NULL);
- if (cap_count > 1) {
- __ta__("_mmcamcorder_sound_init",
-#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
- sound_ret = _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND);
-#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
- sound_ret = _mmcamcorder_sound_init(handle);
-#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
- );
+ mm_sound_volume_add_callback(VOLUME_TYPE_SYSTEM, __volume_level_changed_cb, hcamcorder);
}
}
int _mmcamcorder_image_cmd_preview_stop(MMHandleType handle)
{
int ret = MM_ERROR_NONE;
+ int strobe_mode = MM_CAMCORDER_STROBE_MODE_OFF;
+ int set_strobe = 0;
+ GstCameraControl *control = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
GstElement *pipeline = NULL;
_mmcam_dbg_log("");
- mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ 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);
+ /* check strobe and set OFF if PERMANENT mode */
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_STROBE_MODE, &strobe_mode,
+ 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");
+
+ /* get camera control */
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+
+ /* convert MSL to sensor value */
+ set_strobe = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_MODE, MM_CAMCORDER_STROBE_MODE_OFF);
+
+ /* 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);
+ }
+
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",sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
+ _mmcamcorder_remove_recorder_pipeline(handle);
+ }
+
+ /* Disable skip flush buffer */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "enable-flush-buffer", FALSE);
+
+ 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);
+
ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+
+ /* Enable skip flush buffer */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "enable-flush-buffer", TRUE);
/* deregister sound status callback */
if (sc->info_image->sound_status != _SOUND_STATUS_INIT) {
_mmcam_dbg_log("deregister sound status callback");
- __ta__(" vconf_ignore_key_changed",
vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, __sound_status_changed_cb);
- );
- __ta__(" mm_sound_volume_remove_callback",
- mm_sound_volume_remove_callback(VOLUME_TYPE_MEDIA);
- );
+ mm_sound_volume_remove_callback(VOLUME_TYPE_SYSTEM);
sc->info_image->sound_status = _SOUND_STATUS_INIT;
}
break;
}
- if (ret != MM_ERROR_NONE && sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
- int op_status = 0;
- MMCAMCORDER_G_OBJECT_GET (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "operation-status", &op_status);
- _mmcam_dbg_err("Current Videosrc status[0x%x]", op_status);
- }
-
return ret;
}
int ret = MM_ERROR_NONE;
unsigned char *data = NULL;
unsigned int datalen = 0;
-
+ int provide_exif = FALSE;
+ _MMCamcorderSubContext *sc = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
mmf_return_val_if_fail(hcamcorder, FALSE);
+ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+ mmf_return_val_if_fail(sc, FALSE);
_mmcam_dbg_log("");
if (!original || original->data == NULL || original->length == 0) {
- _mmcam_dbg_err("original=%p, data=%p, length=%d", original, original->data, original->length);
+ if (!original) {
+ _mmcam_dbg_log("original is null");
+ } else {
+ _mmcam_dbg_log("data=%p, length=%d", original->data, original->length);
+ }
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
} else {
/* original is input/output param. save original values to local var. */
data = original->data;
datalen = original->length;
}
-
- if (thumbnail) {
- if (thumbnail->data && thumbnail->length > 0) {
- _mmcam_dbg_log("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d",
- thumbnail->data, thumbnail->width, thumbnail->height);
-
- /* add thumbnail exif info */
- __ta__(" mm_exif_add_thumbnail_info",
- ret = mm_exif_add_thumbnail_info(hcamcorder->exif_info,
- thumbnail->data,
- thumbnail->width,
- thumbnail->height,
- thumbnail->length);
- );
- } else {
- _mmcam_dbg_err("Skip adding thumbnail (data=%p, length=%d)",
- thumbnail->data, thumbnail->length);
+ MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
+ if(provide_exif == 0){
+ if (thumbnail) {
+ if (thumbnail->data && thumbnail->length > 0) {
+ _mmcam_dbg_log("thumbnail is added!thumbnail->data=%p thumbnail->width=%d ,thumbnail->height=%d",
+ thumbnail->data, thumbnail->width, thumbnail->height);
+
+ /* add thumbnail exif info */
+ ret = mm_exif_add_thumbnail_info(hcamcorder->exif_info,
+ thumbnail->data,
+ thumbnail->width,
+ thumbnail->height,
+ thumbnail->length);
+ } else {
+ _mmcam_dbg_err("Skip adding thumbnail (data=%p, length=%d)",
+ thumbnail->data, thumbnail->length);
+ }
}
+ } else {
+ ret = MM_ERROR_NONE;
}
if (ret == MM_ERROR_NONE) {
/* write jpeg with exif */
- __ta__(" mm_exif_write_exif_jpeg_to_memory",
- ret = mm_exif_write_exif_jpeg_to_memory(&original->data, &original->length ,hcamcorder->exif_info, data, datalen);
- );
+ 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);
}
void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstSample *sample)
{
GstCaps *caps = NULL;
- GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+ GstMapInfo mapinfo = GST_MAP_INFO_INIT;
const GstStructure *structure;
mmf_return_if_fail(capture_data && sample);
- caps = gst_sample_get_caps(sample);
+ caps = gst_sample_get_caps(sample);
if (caps == NULL) {
_mmcam_dbg_err("failed to get caps");
goto GET_FAILED;
}
structure = gst_caps_get_structure(caps, 0);
- if (caps == NULL) {
+ if (structure == NULL) {
_mmcam_dbg_err("failed to get structure");
goto GET_FAILED;
}
- gst_buffer_map(gst_sample_get_buffer(sample), &mapinfo, GST_MAP_READ);
- capture_data->data = mapinfo.data;
+ 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);
- capture_data->length = mapinfo.size;
- gst_buffer_unmap(gst_sample_get_buffer(sample), &mapinfo);
+ 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]",
- capture_data->data, capture_data->width, capture_data->height,
- capture_data->length, capture_data->format);
+ _mmcam_dbg_warn("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;
GET_FAILED:
_mmcam_dbg_log("");
- __ta__( " Get:MMCAM_TAG_ENABLE and \"provide-exif\"",
mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ENABLE, &tag_enable, NULL);
MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
- );
/* if dest->data is allocated in MSL, release it */
if (tag_enable && !provide_exif) {
if (dest->data) {
- __ta__( " Free data",
free(dest->data);
- );
dest->length = 0;
dest->data = NULL;
_mmcam_dbg_log("Jpeg is released!");
static void __mmcamcorder_image_capture_cb(GstElement *element, GstSample *sample1, GstSample *sample2, GstSample *sample3, gpointer u_data)
{
int ret = MM_ERROR_NONE;
- int pixtype = MM_PIXEL_FORMAT_INVALID;
- int pixtype_sub = MM_PIXEL_FORMAT_INVALID;
+ int pixtype_main = MM_PIXEL_FORMAT_INVALID;
+ 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 try_lock_count = 0;
gboolean send_captured_message = FALSE;
unsigned char *exif_raw_data = NULL;
+ unsigned char *internal_main_data = NULL;
+ unsigned int internal_main_length = 0;
+ unsigned char *internal_thumb_data = NULL;
+ unsigned int internal_thumb_length = 0;
+ unsigned char *compare_data = NULL;
MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
MMCamcorderCaptureDataType dest = {0,};
MMCamcorderCaptureDataType thumb = {0,};
MMCamcorderCaptureDataType scrnail = {0,};
- GstMapInfo mapinfo1;
- GstMapInfo mapinfo2;
- GstMapInfo mapinfo3;
+ MMCamcorderCaptureDataType encode_src = {0,};
+ GstMapInfo mapinfo1 = GST_MAP_INFO_INIT;
+ GstMapInfo mapinfo2 = GST_MAP_INFO_INIT;
+ GstMapInfo mapinfo3 = GST_MAP_INFO_INIT;
mmf_attrs_t *attrs = NULL;
mmf_attribute_t *item_screennail = NULL;
_mmcam_dbg_err("START - current state %d", current_state);
- MMTA_ACUM_ITEM_BEGIN(" MSL capture callback", FALSE);
-
/* check capture state */
if (info->type == _MMCamcorder_MULTI_SHOT && info->capture_send_count > 0) {
mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, "capture-break-cont-shot", &stop_cont_shot, NULL);
_mmcam_dbg_warn("stop command[%d] or not capturing state[%d]. skip this...",
stop_cont_shot, info->capturing);
- MMTA_ACUM_ITEM_END(" MSL capture callback", FALSE);
-
/*free GstBuffer*/
if (sample1) {
- gst_caps_unref(gst_sample_get_caps(sample1));
- gst_buffer_unref(gst_sample_get_buffer(sample1));
gst_sample_unref(sample1);
}
if (sample2) {
- gst_caps_unref(gst_sample_get_caps(sample2));
- gst_buffer_unref(gst_sample_get_buffer(sample2));
- gst_sample_unref(sample2);
+ gst_sample_unref(sample2);
}
if (sample3) {
- gst_caps_unref(gst_sample_get_caps(sample3));
- gst_buffer_unref(gst_sample_get_buffer(sample3));
- gst_sample_unref(sample3);
+ gst_sample_unref(sample3);
}
return;
/* play capture sound here if multi capture
or preview format is ITLV(because of AF and flash control in plugin) */
if (info->type == _MMCamcorder_MULTI_SHOT) {
- __ta__(" _mmcamcorder_sound_play",
- _mmcamcorder_sound_play((MMHandleType)hcamcorder);
- );
+ pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+ _mmcam_dbg_log("send signal for sound play");
+ hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START;
+ pthread_cond_signal(&(hcamcorder->task_thread_cond));
+ pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
} else if (!info->played_capture_sound) {
- __ta__(" _mmcamcorder_sound_solo_play",
_mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE);
- );
}
}
memset((void *)&scrnail, 0x0, sizeof(MMCamcorderCaptureDataType));
/* Prepare main, thumbnail buffer */
- pixtype = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample1));
- if (pixtype == MM_PIXEL_FORMAT_INVALID) {
+ 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_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
-
goto error;
}
/* Main image buffer */
- gst_buffer_map(gst_sample_get_buffer(sample1), &mapinfo1, GST_MAP_READ);
- if (sample1 && mapinfo1.data && (mapinfo1.size !=0)) {
- __mmcamcorder_get_capture_data_from_buffer(&dest, pixtype, sample1);
- } else {
- _mmcam_dbg_err("Sample1 has wrong pointer. (sample1=%p)",sample1);
+ 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_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
- gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
goto error;
+ }else{
+ if ( (mapinfo1.data == NULL) && (mapinfo1.size == 0) ){
+ _mmcam_dbg_err("mapinfo1 is wrong (%p, size %d)", 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;
+ }else
+ __mmcamcorder_get_capture_data_from_buffer(&dest, pixtype_main, sample1);
}
- /* Encode JPEG */
- if (sc->internal_encode) {
-#ifdef _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE
- int thumb_width = 0;
- int thumb_height = 0;
- int thumb_length = 0;
- unsigned char *thumb_raw_data = NULL;
-#endif /* _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE */
-
- 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);
-
- __ta__(" _mmcamcorder_encode_jpeg:MAIN",
- ret = _mmcamcorder_encode_jpeg(mapinfo1.data, dest.width, dest.height,
- pixtype, dest.length, capture_quality, &(dest.data), &(dest.length));
- );
-
- if (!ret) {
- _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed");
+ 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);
+ }
+ 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_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
+ /* 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];
- goto error;
- }
+ if (sample3 && mapinfo3.data && mapinfo3.size != 0) {
+ _mmcam_dbg_log("Screennail (sample3=%p,size=%d)", sample3, mapinfo3.size);
- /* set format */
- dest.format = MM_PIXEL_FORMAT_ENCODED;
+ pixtype_scrnl = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample3));
+ __mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_scrnl, sample3);
- _mmcam_dbg_log("Done Internal Encode - data %p, length %d", dest.data, dest.length);
+ /* 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);
+ } else {
+ _mmcam_dbg_log("Sample3 has wrong pointer. Not Error. (sample3=%p)",sample3);
+ mmf_attribute_set_data(item_screennail, NULL, 0);
+ }
-#ifdef _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE
- /* make thumbnail image */
- _mmcam_dbg_log("Make thumbnail image");
+ /* commit screennail data */
+ mmf_attribute_commit(item_screennail);
- if (dest.width > THUMBNAIL_WIDTH) {
- float img_ratio = (float)dest.width / (float)dest.height;
+ /* init thumb data */
+ memset(&encode_src, 0x0, sizeof(MMCamcorderCaptureDataType));
- _mmcam_dbg_log("image ratio %f , default ratio %f", img_ratio, THUMBNAIL_DEFAULT_RATIO);
+ /* get provide-exif */
+ MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
- if (img_ratio > THUMBNAIL_DEFAULT_RATIO) {
- thumb_height = THUMBNAIL_HEIGHT;
- thumb_width = (thumb_height * dest.width) / dest.height;
+ /* Thumbnail image buffer */
+ if (sample2 && mapinfo2.data && (mapinfo2.size != 0)) {
+ _mmcam_dbg_log("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);
+
+ if (pixtype_main == MM_PIXEL_FORMAT_ENCODED && provide_exif) {
+ ExifLoader *l;
+ /* get thumbnail from EXIF */
+ l = exif_loader_new();
+ if (l) {
+ ExifData *ed;
+ char width[10];
+ char height[10];
+ ExifEntry *entry = NULL;
+
+ exif_loader_write (l, dest.data, dest.length);
+
+ /* Get a pointer to the EXIF data */
+ ed = exif_loader_get_data(l);
+
+ /* The loader is no longer needed--free it */
+ exif_loader_unref(l);
+ l = NULL;
+ if (ed) {
+ entry = exif_content_get_entry(ed->ifd[EXIF_IFD_1], EXIF_TAG_IMAGE_WIDTH);
+ if (entry != NULL) {
+ exif_entry_get_value(entry,width,10);
+ }
+ entry = NULL;
+ entry = exif_content_get_entry(ed->ifd[EXIF_IFD_1], EXIF_TAG_IMAGE_LENGTH);
+ if (entry != NULL) {
+ exif_entry_get_value(entry,height , 10);
+ }
+ entry = NULL;
+ /* Make sure the image had a thumbnail before trying to write it */
+ if (ed->data && ed->size) {
+ thumb.data = malloc(ed->size);
+ memcpy(thumb.data,ed->data,ed->size);
+ thumb.length = ed->size;
+ #if 0
+ {
+ FILE *fp = NULL;
+ fp = fopen ("/opt/usr/media/thumbnail_test.jpg", "a+");
+ fwrite (thumb.data, 1, thumb.length, fp);
+ fclose (fp);
+ }
+ #endif
+ thumb.format = MM_PIXEL_FORMAT_ENCODED;
+ thumb.width = atoi(width);
+ thumb.height = atoi(height);
+ internal_thumb_data = thumb.data;
+ }
+ exif_data_unref(ed);
+ ed = NULL;
+ } else {
+ _mmcam_dbg_warn("failed to get exif data");
+ }
} else {
- thumb_width = THUMBNAIL_WIDTH;
- thumb_height = (thumb_width * dest.height) / dest.width;
+ _mmcam_dbg_warn("failed to create exif loader");
}
+ }
- _mmcam_dbg_log("need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
-
- if (!_mmcamcorder_resize_frame(mapinfo1.data, dest.width, dest.height, GST_BUFFER_SIZE(buffer1), pixtype,
- &thumb_raw_data, &thumb_width, &thumb_height, &thumb_length)) {
- thumb_raw_data = NULL;
- _mmcam_dbg_warn("_mmcamcorder_resize_frame failed. skip thumbnail making...");
+ if (thumb.data == NULL) {
+ if (pixtype_main == MM_PIXEL_FORMAT_ENCODED &&
+ scrnail.data && scrnail.length != 0) {
+ /* make thumbnail image with screennail data */
+ memcpy(&encode_src, &scrnail, sizeof(MMCamcorderCaptureDataType));
+ } else if (sc->internal_encode) {
+ /* make thumbnail image with main data, this is raw data */
+ memcpy(&encode_src, &dest, sizeof(MMCamcorderCaptureDataType));
}
- } else {
- thumb_width = dest.width;
- thumb_height = dest.height;
+ }
- _mmcam_dbg_log("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
+ /* encode thumbnail */
+ if (encode_src.data) {
+ unsigned int thumb_width = 0;
+ unsigned int thumb_height = 0;
+ unsigned int thumb_length = 0;
+ unsigned char *thumb_raw_data = NULL;
- thumb_raw_data = mapinfo1.data;
- }
+ /* encode image */
+ _mmcam_dbg_log("Encode Thumbnail");
- if (thumb_raw_data) {
- __ta__(" _mmcamcorder_encode_jpeg:THUMBNAIL",
- ret = _mmcamcorder_encode_jpeg(thumb_raw_data, thumb_width, thumb_height,
- pixtype, thumb_length, THUMBNAIL_JPEG_QUALITY, &(thumb.data), &(thumb.length));
- );
- if (ret) {
- _mmcam_dbg_log("encode THUMBNAIL done - data %p, length %d", thumb.data, thumb.length);
+ if (encode_src.width > THUMBNAIL_WIDTH) {
+ /* calculate thumbnail size */
+ thumb_width = THUMBNAIL_WIDTH;
+ thumb_height = (thumb_width * encode_src.height) / encode_src.width;
+ if (thumb_height % 2 != 0) {
+ thumb_height += 1;
+ }
- thumb.width = thumb_width;
- thumb.height = thumb_height;
- thumb.format = MM_PIXEL_FORMAT_ENCODED;
+ _mmcam_dbg_log("need to resize : thumbnail size %dx%d, format %d",
+ thumb_width, thumb_height, encode_src.format);
+
+ if ((encode_src.format == MM_PIXEL_FORMAT_UYVY ||
+ encode_src.format == MM_PIXEL_FORMAT_YUYV) &&
+ encode_src.width % thumb_width == 0 &&
+ encode_src.height % thumb_height == 0) {
+ 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...");
+ }
+ } 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...");
+ }
+ }
} else {
- _mmcam_dbg_warn("failed to encode THUMBNAIL");
- }
+ thumb_width = encode_src.width;
+ thumb_height = encode_src.height;
- if (thumb_raw_data != mapinfo1.data) {
- free(thumb_raw_data);
- thumb_raw_data = NULL;
- _mmcam_dbg_log("release thumb_raw_data");
+ _mmcam_dbg_log("NO need to resize : thumbnail size %dx%d", thumb_width, thumb_height);
+
+ thumb_raw_data = encode_src.data;
+ thumb_length = encode_src.length;
}
- } else {
- _mmcam_dbg_warn("thumb_raw_data is NULL");
- }
-#endif /* _MMCAMCORDER_MAKE_THUMBNAIL_INTERNAL_ENCODE */
- gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
- } else {
- gst_buffer_map(gst_sample_get_buffer(sample2), &mapinfo2, GST_MAP_READ);
- /* Thumbnail image buffer */
- if (sample2 && mapinfo2.data && (mapinfo2.size !=0)) {
- _mmcam_dbg_log("Thumnail (sample2=%p)",sample2);
- pixtype_sub = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample2));
- __mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_sub, sample2);
+ if (thumb_raw_data) {
+ ret = _mmcamcorder_encode_jpeg(thumb_raw_data, thumb_width, thumb_height,
+ encode_src.format, thumb_length, THUMBNAIL_JPEG_QUALITY,
+ (void **)&internal_thumb_data, &internal_thumb_length, JPEG_ENCODER_SOFTWARE);
+ if (ret) {
+ _mmcam_dbg_log("encode THUMBNAIL done - data %p, length %d",
+ internal_thumb_data, internal_thumb_length);
+
+ thumb.data = internal_thumb_data;
+ thumb.length = internal_thumb_length;
+ thumb.width = thumb_width;
+ thumb.height = thumb_height;
+ thumb.format = MM_PIXEL_FORMAT_ENCODED;
+ } else {
+ _mmcam_dbg_warn("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");
+ }
+ } else {
+ _mmcam_dbg_warn("thumb_raw_data is NULL");
+ }
} else {
- _mmcam_dbg_log("Sample2 has wrong pointer. Not Error. (sample2=%p)",sample2);
+ // no raw data src for thumbnail
+ _mmcam_dbg_log("no need to encode thumbnail");
}
- gst_buffer_unmap(gst_sample_get_buffer(sample2), &mapinfo2);
}
- /* 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];
+ /* Encode JPEG */
+ if (sc->internal_encode && pixtype_main != MM_PIXEL_FORMAT_ENCODED) {
+ 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);
- gst_buffer_map(gst_sample_get_buffer(sample3), &mapinfo3, GST_MAP_READ);
- if (sample3 && mapinfo3.data && mapinfo3.size != 0) {
- _mmcam_dbg_log("Screennail (sample3=%p,size=%d)", sample3, mapinfo3.size);
+ ret = _mmcamcorder_encode_jpeg(mapinfo1.data, dest.width, dest.height,
+ pixtype_main, dest.length, capture_quality,
+ (void **)&internal_main_data, &internal_main_length, JPEG_ENCODER_HARDWARE);
+ if (!ret) {
+ _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed");
- pixtype_sub = _mmcamcorder_get_pixel_format(gst_sample_get_caps(sample3));
- __mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_sub, sample3);
+ MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
- /* 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);
- } else {
- _mmcam_dbg_log("Sample3 has wrong pointer. Not Error. (sample3=%p)",sample3);
- mmf_attribute_set_data(item_screennail, NULL, 0);
- }
- gst_buffer_unmap(gst_sample_get_buffer(sample3), &mapinfo3);
+ goto error;
+ }
- /* commit screennail data */
- mmf_attribute_commit(item_screennail);
+ /* set format */
+ dest.data = internal_main_data;
+ 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);
+ }
/* create EXIF info */
- __ta__(" mm_exif_create_exif_info",
- ret = mm_exif_create_exif_info(&(hcamcorder->exif_info));
- );
+ if(!provide_exif){ // make new exif
+ ret = mm_exif_create_exif_info(&(hcamcorder->exif_info));
+ } 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);
+ 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);
} else {
/* add basic exif info */
- _mmcam_dbg_log("add basic exif info");
- __ta__(" __mmcamcorder_set_exif_basic_info",
- ret = __mmcamcorder_set_exif_basic_info((MMHandleType)hcamcorder, dest.width, dest.height);
- );
+ if(!provide_exif) {
+ _mmcam_dbg_log("add basic exif info");
+ ret = __mmcamcorder_set_exif_basic_info((MMHandleType)hcamcorder, dest.width, dest.height);
+ } else {
+ _mmcam_dbg_log("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);
ret = MM_ERROR_NONE;
/* commit EXIF data */
mmf_attribute_commit(item_exif_raw_data);
- /* get tag-enable and provide-exif */
+ /* get tag-enable */
mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, MMCAM_TAG_ENABLE, &tag_enable, NULL);
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif);
/* Set extra data for JPEG if tag enabled and doesn't provide EXIF */
- if (dest.format == MM_PIXEL_FORMAT_ENCODED &&
- tag_enable && !provide_exif) {
- mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
- MMCAM_IMAGE_ENCODER, &codectype,
- NULL);
- _mmcam_dbg_log("codectype %d", codectype);
-
- switch (codectype) {
- case MM_IMAGE_CODEC_JPEG:
- case MM_IMAGE_CODEC_SRW:
- case MM_IMAGE_CODEC_JPEG_SRW:
- __ta__( " __mmcamcorder_set_jpeg_data",
- ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb);
- );
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Error on setting extra data to jpeg");
- MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, ret);
+ if (dest.format == MM_PIXEL_FORMAT_ENCODED){
+ if (tag_enable) {
+ mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
+ MMCAM_IMAGE_ENCODER, &codectype,
+ NULL);
+ _mmcam_dbg_log("codectype %d", codectype);
+
+ switch (codectype) {
+ case MM_IMAGE_CODEC_JPEG:
+ case MM_IMAGE_CODEC_SRW:
+ case MM_IMAGE_CODEC_JPEG_SRW:
+ ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("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_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
goto error;
}
- break;
- default:
- _mmcam_dbg_err("The codectype is not supported. (%d)", codectype);
-
- MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL);
-
- goto error;
}
}
if (hcamcorder->vcapture_cb) {
_mmcam_dbg_log("APPLICATION CALLBACK START");
- MMTA_ACUM_ITEM_BEGIN(" Application capture callback", 0);
if (thumb.data) {
ret = hcamcorder->vcapture_cb(&dest, &thumb, hcamcorder->vcapture_cb_param);
} else {
ret = hcamcorder->vcapture_cb(&dest, NULL, hcamcorder->vcapture_cb_param);
}
- MMTA_ACUM_ITEM_END(" Application capture callback", 0);
_mmcam_dbg_log("APPLICATION CALLBACK END");
} else {
_mmcam_dbg_err("Capture callback is NULL.");
_MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(hcamcorder);
/* init screennail and EXIF raw data */
- __ta__(" init attributes:scrnl and EXIF",
mmf_attribute_set_data(item_screennail, NULL, 0);
mmf_attribute_commit(item_screennail);
if (exif_raw_data) {
mmf_attribute_set_data(item_exif_raw_data, NULL, 0);
mmf_attribute_commit(item_exif_raw_data);
}
- );
/* Release jpeg data */
- if (pixtype == MM_PIXEL_FORMAT_ENCODED) {
- __ta__(" __mmcamcorder_release_jpeg_data",
+ if (pixtype_main == MM_PIXEL_FORMAT_ENCODED) {
__mmcamcorder_release_jpeg_data((MMHandleType)hcamcorder, &dest);
- );
}
error:
/* release internal allocated data */
if (sc->internal_encode) {
- if (dest.data) {
- free(dest.data);
- dest.data = NULL;
- dest.length = 0;
- _mmcam_dbg_log("release internal encoded data MAIN");
- }
- if (thumb.data) {
- free(thumb.data);
- thumb.data = NULL;
- thumb.length = 0;
- _mmcam_dbg_log("release internal encoded data THUMB");
- }
+ compare_data = internal_main_data;
+ } else {
+ compare_data = mapinfo1.data;
+ }
+ if (dest.data && compare_data &&
+ dest.data != compare_data) {
+ _mmcam_dbg_log("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);
+ free(internal_main_data);
+ internal_main_data = NULL;
}
+ if (internal_thumb_data) {
+ _mmcam_dbg_log("release internal thumb data %p", internal_thumb_data);
+ free(internal_thumb_data);
+ internal_thumb_data = NULL;
+ }
+
+ /* reset compare_data */
+ compare_data = NULL;
/*free GstBuffer*/
- if (sample1) {
- gst_caps_unref(gst_sample_get_caps(sample1));
- gst_buffer_unref(gst_sample_get_buffer(sample1));
- gst_sample_unref(sample1);
- }
- if (sample2) {
- gst_caps_unref(gst_sample_get_caps(sample2));
- gst_buffer_unref(gst_sample_get_buffer(sample2));
- gst_sample_unref(sample2);
- }
- if (sample3) {
- gst_caps_unref(gst_sample_get_caps(sample3));
- gst_buffer_unref(gst_sample_get_buffer(sample3));
- gst_sample_unref(sample3);
- }
+ if (sample1) {
+ gst_buffer_unmap(gst_sample_get_buffer(sample1), &mapinfo1);
+ gst_sample_unref(sample1);
+ }
+ if (sample2) {
+ gst_buffer_unmap(gst_sample_get_buffer(sample2), &mapinfo2);
+ gst_sample_unref(sample2);
+ }
+ if (sample3) {
+ gst_buffer_unmap(gst_sample_get_buffer(sample3), &mapinfo3);
+ gst_sample_unref(sample3);
+ }
/* destroy exif info */
- __ta__(" mm_exif_destory_exif_info",
mm_exif_destory_exif_info(hcamcorder->exif_info);
- );
hcamcorder->exif_info = NULL;
/* send captured message */
if (send_captured_message) {
- MMTA_ACUM_ITEM_BEGIN(" CAPTURED MESSAGE DELAY", FALSE);
-
if (info->hdr_capture_mode != MM_CAMCORDER_HDR_ON_AND_ORIGINAL) {
- MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
-
- mm_camcorder_get_state((MMHandleType)hcamcorder, ¤t_state);
-
/* Send CAPTURED message and count - capture success */
if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED, count);
}
}
- MMTA_ACUM_ITEM_END( " MSL capture callback", FALSE );
+ /* Handle capture in recording case */
+ if (hcamcorder->capture_in_recording) {
+ hcamcorder->capture_in_recording = FALSE;
+ }
_mmcam_dbg_err("END");
}
-static gboolean __mmcamcorder_encodesink_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data)
+gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
_MMCamcorderSubContext *sc = NULL;
mmf_return_val_if_fail(sc && sc->element, FALSE);
_mmcam_dbg_log("");
- /* 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);
+ /* 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);
- if (sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "signal-handoffs", FALSE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "signal-handoffs", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ sc->info_video->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
}
return TRUE;
}
-/* Take a picture with capture mode */
-int _mmcamcorder_set_resize_property(MMHandleType handle, int capture_width, int capture_height)
+static ExifData *__mmcamcorder_update_exif_orientation(MMHandleType handle, ExifData *ed)
{
- int ELEMENT_CROP = 0;
- int ELEMENT_FILTER = 0;
+ int value = 0;
+ ExifShort eshort = 0;
+ int ret = MM_ERROR_NONE;
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderSubContext *sc = NULL;
+ mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ORIENTATION, &value, NULL);
+ _mmcam_dbg_log("get orientation [%d]",value);
+ if (value == 0) {
+ value = MM_EXIF_ORIENTATION;
+ }
- _mmcam_dbg_log("");
+ exif_set_short((unsigned char *)&eshort, exif_data_get_byte_order(ed), value);
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_ORIENTATION,
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_MAKER_NOTE);
+ }
- mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+exit:
+ return ed;
+}
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- ELEMENT_CROP = _MMCAMCORDER_ENCSINK_ICROP;
- ELEMENT_FILTER = _MMCAMCORDER_ENCSINK_IFILT;
+static ExifData *__mmcamcorder_update_exif_make(MMHandleType handle, ExifData *ed)
+{
+ int ret = MM_ERROR_NONE;
+ char *make = strdup(MM_MAKER_NAME);
+
+ if (make) {
+ _mmcam_dbg_log("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 {
+ ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
+ EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
+ }
+
+exit:
+ return ed;
+}
- /*TODO: this is not needed now. */
- return MM_ERROR_NONE;
+static ExifData *__mmcamcorder_update_exif_software(MMHandleType handle, ExifData *ed)
+{
+ int ret = MM_ERROR_NONE;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+
+ if (hcamcorder == NULL || ed == NULL) {
+ _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed);
+ return NULL;
+ }
+
+ if (hcamcorder->software_version) {
+ 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);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("set software_version[%s] failed", hcamcorder->software_version);
+ } else {
+ _mmcam_dbg_log("set software_version[%s] done", hcamcorder->software_version);
+ }
+ } else {
+ _mmcam_dbg_err("model_name is NULL");
+ }
+
+ return ed;
}
+static ExifData *__mmcamcorder_update_exif_model(MMHandleType handle, ExifData *ed)
+{
+ int ret = MM_ERROR_NONE;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+
+ if (hcamcorder == NULL || ed == NULL) {
+ _mmcam_dbg_err("NULL parameter %p,%p", hcamcorder, ed);
+ return NULL;
+ }
+
+ if (hcamcorder->model_name) {
+ 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);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("set model name[%s] failed", hcamcorder->model_name);
+ } else {
+ _mmcam_dbg_log("set model name[%s] done", hcamcorder->model_name);
+ }
+ } else {
+ _mmcam_dbg_err("model_name is NULL");
+ }
+
+ return ed;
+}
+
+static ExifData *__mmcamcorder_update_exif_gps(MMHandleType handle, ExifData *ed)
+{
+ int ret = MM_ERROR_NONE;
+ int gps_enable = TRUE;
+ char *err_name = NULL;
+ double latitude = INVALID_GPS_VALUE;
+ double longitude = INVALID_GPS_VALUE;
+ double altitude = INVALID_GPS_VALUE;
+
+ ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_GPS_ENABLE, &gps_enable, NULL);
+ if (ret == MM_ERROR_NONE && gps_enable) {
+ ExifByte GpsVersion[4]={2,2,0,0};
+
+ _mmcam_dbg_log("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);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_VERSION_ID);
+ }
+
+ ret = mm_camcorder_get_attributes(handle, &err_name,
+ MMCAM_TAG_LATITUDE, &latitude,
+ 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);
+ SAFE_FREE(err_name);
+ goto exit;
+ }
+
+ _mmcam_dbg_log("latitude [%f]", latitude);
+ if (latitude != INVALID_GPS_VALUE) {
+ unsigned char *b = NULL;
+ unsigned int deg;
+ unsigned int min;
+ unsigned int sec;
+ ExifRational rData;
+
+ if (latitude < 0) {
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
+ EXIF_FORMAT_ASCII, 2, "S");
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
+ }
+ latitude = -latitude;
+ } else if (latitude > 0) {
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
+ EXIF_FORMAT_ASCII, 2, "N");
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
+ }
+ }
+
+ deg = (unsigned int)(latitude);
+ 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);
+ b = malloc(3 * sizeof(ExifRational));
+ if (b) {
+ rData.numerator = deg;
+ rData.denominator = 1;
+ exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+ rData.numerator = min;
+ exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
+ rData.numerator = sec;
+ exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
+
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE,
+ EXIF_FORMAT_RATIONAL, 3, (const char *)b);
+ free(b);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE);
+ }
+ } else {
+ _mmcam_dbg_warn("malloc failed");
+ }
+ }
+
+ _mmcam_dbg_log("longitude [%f]", longitude);
+ if (longitude != INVALID_GPS_VALUE) {
+ unsigned char *b = NULL;
+ unsigned int deg;
+ unsigned int min;
+ unsigned int sec;
+ ExifRational rData;
+
+ if (longitude < 0) {
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
+ EXIF_FORMAT_ASCII, 2, "W");
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
+ }
+ longitude = -longitude;
+ } else if (longitude > 0) {
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
+ EXIF_FORMAT_ASCII, 2, "E");
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
+ }
+ }
+
+ deg = (unsigned int)(longitude);
+ 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);
+ b = malloc(3 * sizeof(ExifRational));
+ if (b) {
+ rData.numerator = deg;
+ rData.denominator = 1;
+ exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+ rData.numerator = min;
+ exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
+ rData.numerator = sec;
+ exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE,
+ EXIF_FORMAT_RATIONAL, 3, (const char *)b);
+ free(b);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE);
+ }
+ } else {
+ _mmcam_dbg_warn("malloc failed");
+ }
+ }
+
+ _mmcam_dbg_log("f_altitude [%f]", altitude);
+ if (altitude != INVALID_GPS_VALUE) {
+ ExifByte alt_ref = 0;
+ unsigned char *b = NULL;
+ ExifRational rData;
+ b = malloc(sizeof(ExifRational));
+ if (b) {
+ if (altitude < 0) {
+ alt_ref = 1;
+ altitude = -altitude;
+ }
+
+ 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);
+ if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
+ free(b);
+ b = NULL;
+ goto exit;
+ }
+ }
+
+ rData.numerator = (unsigned int)(altitude + 0.5)*100;
+ rData.denominator = 100;
+ exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE,
+ EXIF_FORMAT_RATIONAL, 1, (const char *)b);
+ free(b);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_ALTITUDE);
+ }
+ } else {
+ _mmcam_dbg_warn("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);
+ if (gps_timestamp > 0.0) {
+ unsigned char *b = NULL;
+ unsigned int hour;
+ unsigned int min;
+ unsigned int microsec;
+ ExifRational rData;
+
+ hour = (unsigned int)(gps_timestamp / 3600);
+ 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);
+ b = malloc(3 * sizeof(ExifRational));
+ if (b) {
+ rData.numerator = hour;
+ rData.denominator = 1;
+ exif_set_rational(b, exif_data_get_byte_order(ed), rData);
+
+ rData.numerator = min;
+ rData.denominator = 1;
+ exif_set_rational(b + 8, exif_data_get_byte_order(ed), rData);
+
+ rData.numerator = microsec;
+ rData.denominator = 1000000;
+ exif_set_rational(b + 16, exif_data_get_byte_order(ed), rData);
+
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_TIME_STAMP,
+ EXIF_FORMAT_RATIONAL, 3, (const char *)b);
+ free(b);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_TIME_STAMP);
+ }
+ } else {
+ _mmcam_dbg_warn( "malloc failed." );
+ }
+ }
+ }
+
+ {
+ unsigned char *date_stamp = NULL;
+ int date_stamp_len = 0;
+
+ 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);
+
+ /* cause it should include NULL char */
+ ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_DATE_STAMP,
+ EXIF_FORMAT_ASCII, date_stamp_len + 1, (const char *)date_stamp);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_DATE_STAMP);
+ }
+ }
+ }
+
+ {
+ unsigned char *processing_method = NULL;
+ int processing_method_len = 0;
+
+ 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);
+
+ 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);
+ if (ret != MM_ERROR_NONE) {
+ EXIF_SET_ERR(ret, EXIF_TAG_GPS_PROCESSING_METHOD);
+ }
+ }
+ }
+ } else {
+ _mmcam_dbg_log( "Tag for GPS is DISABLED." );
+ }
+
+exit:
+ return ed;
+}
+
+
+int __mmcamcorder_update_exif_info(MMHandleType handle, void* imagedata, int imgln)
+{
+ int ret = MM_ERROR_NONE;
+ mmf_camcorder_t *hcamcorder = NULL;
+ ExifData *ed = NULL;
+
+ hcamcorder = MMF_CAMCORDER(handle);
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ ed = exif_data_new_from_data(imagedata, imgln);
+ //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));
+ return MM_ERROR_INVALID_HANDLE;
+ }
+
+ /* update necessary */
+
+ __mmcamcorder_update_exif_make(handle, ed);
+ __mmcamcorder_update_exif_software(handle, ed);
+ __mmcamcorder_update_exif_model(handle, ed);
+ __mmcamcorder_update_exif_orientation(handle, ed);
+ __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);
+ }
+
+ exif_data_unref(ed);
+ ed = NULL;
+ return ret;
+}
+
int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int image_height)
{
int ret = MM_ERROR_NONE;
int value;
int str_val_len = 0;
- int gps_enable = TRUE;
int cntl = 0;
int cnts = 0;
- double f_latitude = INVALID_GPS_VALUE;
- double f_longitude = INVALID_GPS_VALUE;
- double f_altitude = INVALID_GPS_VALUE;
char *str_value = NULL;
-#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */
- char *maker = NULL;
-#endif
char *user_comment = NULL;
- char *err_name = NULL;
ExifData *ed = NULL;
ExifLong config;
ExifLong ExifVersion;
} else {
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
/* get device information */
- __ta__(" gst_camera_control_get_exif_info",
gst_camera_control_get_exif_info(control, &avsys_exif_info);
- );
}
/* get ExifData from exif info */
- __ta__(" mm_exif_get_exif_from_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));
return MM_ERROR_INVALID_HANDLE;
/*0. EXIF_TAG_EXIF_VERSION */
ExifVersion = MM_EXIF_VERSION;
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXIF_VERSION,
- EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&ExifVersion);
+ EXIF_FORMAT_UNDEFINED, 4, (const char *)&ExifVersion);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_EXIF_VERSION);
}
exif_set_long((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH,
- EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl]);
+ EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_WIDTH);
}
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_PIXEL_X_DIMENSION,
- EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+ EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_X_DIMENSION);
}
exif_set_long((unsigned char *)&elong[cntl], exif_data_get_byte_order (ed), value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH,
- EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl]);
+ EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_LENGTH);
}
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_PIXEL_Y_DIMENSION,
- EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+ EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_PIXEL_Y_DIMENSION);
}
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, b);
+ 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 == MM_ERROR_CAMCORDER_LOW_MEMORY) {
+ if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
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, b);
+ 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 == MM_ERROR_CAMCORDER_LOW_MEMORY) {
+ if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
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, b);
- if (ret != MM_ERROR_NONE) {
- if (ret == MM_ERROR_CAMCORDER_LOW_MEMORY) {
- free(b);
- }
- EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_DIGITIZED);
- }
-
- free(b);
- }
-
-#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */
- /*5. EXIF_TAG_MAKE */
- maker = strdup(MM_MAKER_NAME);
- if (maker) {
- _mmcam_dbg_log("maker [%s]", maker);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_MAKE,
- EXIF_FORMAT_ASCII, strlen(maker), (unsigned char *)maker);
- free(maker);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
- }
- } else {
- ret = MM_ERROR_CAMCORDER_LOW_MEMORY;
- EXIF_SET_ERR(ret, EXIF_TAG_MAKE);
- }
-
- /*6. EXIF_TAG_MODEL */
- _mmcamcorder_conf_get_value_string(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_GENERAL,
- "ModelName",
- &str_value);
- _mmcam_dbg_log("model_name [%s]", str_value);
- if (str_value) {
- char *model = strdup(str_value);
- mm_exif_set_add_entry(ed,EXIF_IFD_0,EXIF_TAG_MODEL,EXIF_FORMAT_ASCII,strlen(model)+1, (unsigned char*)model);
- free(model);
- str_value = NULL;
+ 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) {
- EXIF_SET_ERR(ret, EXIF_TAG_MODEL);
+ if (ret == (int)MM_ERROR_CAMCORDER_LOW_MEMORY) {
+ free(b);
+ }
+ EXIF_SET_ERR(ret, EXIF_TAG_DATE_TIME_DIGITIZED);
}
- } else {
- _mmcam_dbg_warn("failed to get model name");
+
+ free(b);
}
+
+ /*5. EXIF_TAG_MAKE */
+ __mmcamcorder_update_exif_make(handle, ed);
+
+#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */
+
+ /*6. EXIF_TAG_MODEL */
+ __mmcamcorder_update_exif_model(handle, ed);
+
#endif
/*6. EXIF_TAG_IMAGE_DESCRIPTION */
mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &str_value, &str_val_len, NULL);
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), (unsigned char *)description);
+ EXIF_FORMAT_ASCII, strlen(description), (const char *)description);
free(description);
str_value = NULL;
str_val_len = 0;
}
/*7. EXIF_TAG_SOFTWARE*/
+ __mmcamcorder_update_exif_software(handle, ed);
+
/*
if (control != NULL) {
char software[50] = {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);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_SOFTWARE,
- EXIF_FORMAT_ASCII, len, software);
+ EXIF_FORMAT_ASCII, len, (const char *)software);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SOFTWARE);
}
}
*/
- /*8. EXIF_TAG_ORIENTATION */
- mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ORIENTATION, &value, NULL);
- _mmcam_dbg_log("get orientation [%d]",value);
- if (value == 0) {
- value = MM_EXIF_ORIENTATION;
- }
-
- exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), value);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_ORIENTATION,
- EXIF_FORMAT_SHORT, 1, (unsigned char*)&eshort[cnts++]);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_ORIENTATION);
- }
+ __mmcamcorder_update_exif_orientation(handle, ed);
/* START INSERT EXIF_IFD */
if (user_comment) {
_mmcam_dbg_log("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), (unsigned char *)user_comment);
+ EXIF_FORMAT_ASCII, strlen(user_comment), (const char *)user_comment);
free(user_comment);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_USER_COMMENT);
if (control != NULL) {
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.colorspace);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COLOR_SPACE,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_COLOR_SPACE);
}
config = avsys_exif_info.component_configuration;
_mmcam_dbg_log("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ",config);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION,
- EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&config);
+ EXIF_FORMAT_UNDEFINED, 4, (const char *)&config);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_COMPONENTS_CONFIGURATION);
}
ExifRational rData;
_mmcam_dbg_log("EXIF_TAG_EXPOSURE_TIME numerator [%d], denominator [%d]",
- avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator)
+ avsys_exif_info.exposure_time_numerator, avsys_exif_info.exposure_time_denominator);
b = malloc(sizeof(ExifRational));
if (b) {
exif_set_rational(b, exif_data_get_byte_order(ed), rData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_TIME,
- EXIF_FORMAT_RATIONAL, 1, b);
+ EXIF_FORMAT_RATIONAL, 1, (const char *)b);
free(b);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_TIME);
rData.denominator = avsys_exif_info.aperture_f_num_denominator;
exif_set_rational(b, exif_data_get_byte_order(ed), rData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FNUMBER,
- EXIF_FORMAT_RATIONAL, 1, b);
+ EXIF_FORMAT_RATIONAL, 1, (const char *)b);
free(b);
if(ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_FNUMBER);
value = MM_EXPOSURE_PROGRAM;
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_EXPOSURE_PROGRAM,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_PROGRAM);
}
_mmcam_dbg_log("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, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_ISO_SPEED_RATINGS);
}
rsData.denominator = avsys_exif_info.shutter_speed_denominator;
exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SHUTTER_SPEED_VALUE,
- EXIF_FORMAT_SRATIONAL, 1, b);
+ EXIF_FORMAT_SRATIONAL, 1, (const char *)b);
free(b);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SHUTTER_SPEED_VALUE);
rData.denominator = 1;
exif_set_rational(b, exif_data_get_byte_order(ed), rData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_APERTURE_VALUE,
- EXIF_FORMAT_RATIONAL, 1, b);
+ EXIF_FORMAT_RATIONAL, 1, (const char *)b);
free(b);
if(ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_APERTURE_VALUE);
rsData.denominator = avsys_exif_info.brightness_denominator;
exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_BRIGHTNESS_VALUE,
- EXIF_FORMAT_SRATIONAL, 1, b);
+ EXIF_FORMAT_SRATIONAL, 1, (const char *)b);
free(b);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_BRIGHTNESS_VALUE);
/*21. EXIF_TAG_EXPOSURE_BIAS_VALUE*/
value = 0;
- MMCamAttrsInfo info;
- mm_camcorder_get_attribute_info(handle, MMCAM_FILTER_BRIGHTNESS, &info);
-
ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_FILTER_BRIGHTNESS, &value, NULL);
if (ret == MM_ERROR_NONE) {
unsigned char *b = NULL;
ExifSRational rsData;
- _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE %d",value);
+ _mmcam_dbg_log("EXIF_TAG_BRIGHTNESS_VALUE %d, default %d, step denominator %d",
+ value, hcamcorder->brightness_default, hcamcorder->brightness_step_denominator);
b = malloc(sizeof(ExifSRational));
if (b) {
- if( info.int_range.min < info.int_range.max) {
- rsData.numerator = (value - 4) * 5;
- rsData.denominator = 10;
- }
- else {
- rsData.numerator = 0;
- rsData.denominator = 10;
+ rsData.numerator = value - hcamcorder->brightness_default;
+ if (hcamcorder->brightness_step_denominator != 0) {
+ rsData.denominator = hcamcorder->brightness_step_denominator;
+ } else {
+ _mmcam_dbg_warn("brightness_step_denominator is ZERO, so set 1");
+ rsData.denominator = 1;
}
exif_set_srational(b, exif_data_get_byte_order(ed), rsData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_BIAS_VALUE,
- EXIF_FORMAT_SRATIONAL, 1, b);
+ EXIF_FORMAT_SRATIONAL, 1, (const char *)b);
free(b);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_BIAS_VALUE);
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);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_METERING_MODE,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_METERING_MODE);
}
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);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_FLASH);
}
rData.denominator = avsys_exif_info.focal_len_denominator;
exif_set_rational(b, exif_data_get_byte_order(ed), rData);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FOCAL_LENGTH,
- EXIF_FORMAT_RATIONAL, 1, b);
+ EXIF_FORMAT_RATIONAL, 1, (const char *)b);
free(b);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_FOCAL_LENGTH);
value = MM_SENSING_MODE;
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_SENSING_METHOD,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SENSING_METHOD);
}
value = MM_FILE_SOURCE;
exif_set_long(&elong[cntl], exif_data_get_byte_order(ed),value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FILE_SOURCE,
- EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&elong[cntl++]);
+ EXIF_FORMAT_UNDEFINED, 4, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_FILE_SOURCE);
}
value = MM_SCENE_TYPE;
exif_set_long(&elong[cntl], exif_data_get_byte_order(ed),value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SCENE_TYPE,
- EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&elong[cntl++]);
+ EXIF_FORMAT_UNDEFINED, 4, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SCENE_TYPE);
}
value = MM_EXPOSURE_MODE;
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_EXPOSURE_MODE,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_EXPOSURE_MODE);
}
if (ret == MM_ERROR_NONE) {
int set_value = 0;
_mmcam_dbg_log("WHITE BALANCE [%d]", value);
-
+
if (value == MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC) {
set_value = 0;
} else {
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), set_value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_WHITE_BALANCE,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_WHITE_BALANCE);
}
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,
- EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+ EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_DIGITAL_ZOOM_RATIO);
}
value = MM_FOCAL_LENGTH_35MMFILM;
exif_set_short(&eshort[cnts], exif_data_get_byte_order(ed),value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM);
}
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), scene_capture_type);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SCENE_CAPTURE_TYPE,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SCENE_CAPTURE_TYPE);
}
value = MM_GAIN_CONTROL;
exif_set_long(&elong[cntl], exif_data_get_byte_order(ed), value);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_GAIN_CONTROL,
- EXIF_FORMAT_LONG, 1, (unsigned char *)&elong[cntl++]);
+ EXIF_FORMAT_LONG, 1, (const char *)&elong[cntl++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_GAIN_CONTROL);
}
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), level);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_CONTRAST,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_CONTRAST);
}
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), level);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SATURATION,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SATURATION);
}
exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), level);
ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_SHARPNESS,
- EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SHARPNESS);
}
_mmcam_dbg_log("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, (unsigned char *)&eshort[cnts++]);
+ EXIF_FORMAT_SHORT, 1, (const char *)&eshort[cnts++]);
if (ret != MM_ERROR_NONE) {
EXIF_SET_ERR(ret, EXIF_TAG_SUBJECT_DISTANCE_RANGE);
}
/* GPS information */
- ret = mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_GPS_ENABLE, &gps_enable, NULL);
- if (ret == MM_ERROR_NONE && gps_enable) {
- ExifByte GpsVersion[4]={2,2,0,0};
-
- _mmcam_dbg_log("Tag for GPS is ENABLED.");
-
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_VERSION_ID,
- EXIF_FORMAT_BYTE, 4, (unsigned char *)&GpsVersion);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_VERSION_ID);
- }
-
- /*41. Latitude*/
- ret = mm_camcorder_get_attributes(handle, &err_name,
- MMCAM_TAG_LATITUDE, &f_latitude,
- MMCAM_TAG_LONGITUDE, &f_longitude,
- MMCAM_TAG_ALTITUDE, &f_altitude, NULL);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to get gps info [%x][%s]", ret, err_name);
- SAFE_FREE(err_name);
- goto exit;
- }
-
- _mmcam_dbg_log("f_latitude [%f]", f_latitude);
- if (f_latitude != INVALID_GPS_VALUE) {
- unsigned char *b = NULL;
- unsigned int deg;
- unsigned int min;
- unsigned int sec;
- ExifRational rData;
-
- if (f_latitude < 0) {
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
- EXIF_FORMAT_ASCII, 2, (unsigned char *)"S");
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
- }
- f_latitude = -f_latitude;
- } else if (f_latitude > 0) {
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE_REF,
- EXIF_FORMAT_ASCII, 2, (unsigned char *)"N");
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE_REF);
- }
- }
-
- deg = (unsigned int)(f_latitude);
- min = (unsigned int)((f_latitude-deg)*60);
- sec = (unsigned int)(((f_latitude-deg)*3600)-min*60);
-
- _mmcam_dbg_log("f_latitude deg[%d], min[%d], sec[%d]", deg, min, sec);
- b = malloc(3 * sizeof(ExifRational));
- if (b) {
- rData.numerator = deg;
- rData.denominator = 1;
- exif_set_rational(b, exif_data_get_byte_order(ed), rData);
- rData.numerator = min;
- exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
- rData.numerator = sec;
- exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
-
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LATITUDE,
- EXIF_FORMAT_RATIONAL, 3, (unsigned char *)b);
- free(b);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_LATITUDE);
- }
- } else {
- _mmcam_dbg_warn("malloc failed");
- }
- }
-
- /*42. Longitude*/
- _mmcam_dbg_log("f_longitude [%f]", f_longitude);
- if (f_longitude != INVALID_GPS_VALUE) {
- unsigned char *b = NULL;
- unsigned int deg;
- unsigned int min;
- unsigned int sec;
- ExifRational rData;
-
- if (f_longitude < 0) {
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
- EXIF_FORMAT_ASCII, 2, (unsigned char *)"W");
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
- }
- f_longitude = -f_longitude;
- } else if (f_longitude > 0) {
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE_REF,
- EXIF_FORMAT_ASCII, 2, (unsigned char *)"E");
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE_REF);
- }
- }
-
- deg = (unsigned int)(f_longitude);
- min = (unsigned int)((f_longitude-deg)*60);
- sec = (unsigned int)(((f_longitude-deg)*3600)-min*60);
-
- _mmcam_dbg_log("f_longitude deg[%d], min[%d], sec[%d]", deg, min, sec);
- b = malloc(3 * sizeof(ExifRational));
- if (b) {
- rData.numerator = deg;
- rData.denominator = 1;
- exif_set_rational(b, exif_data_get_byte_order(ed), rData);
- rData.numerator = min;
- exif_set_rational(b+8, exif_data_get_byte_order(ed), rData);
- rData.numerator = sec;
- exif_set_rational(b+16, exif_data_get_byte_order(ed), rData);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_LONGITUDE,
- EXIF_FORMAT_RATIONAL, 3, (unsigned char *)b);
- free(b);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_LONGITUDE);
- }
- } else {
- _mmcam_dbg_warn("malloc failed");
- }
- }
-
- /*43. Altitude*/
- _mmcam_dbg_log("f_altitude [%f]", f_altitude);
- if (f_altitude != INVALID_GPS_VALUE) {
- ExifByte alt_ref = 0;
- unsigned char *b = NULL;
- ExifRational rData;
- b = malloc(sizeof(ExifRational));
- if (b) {
- if (f_altitude < 0) {
- alt_ref = 1;
- f_altitude = -f_altitude;
- }
-
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE_REF,
- EXIF_FORMAT_BYTE, 1, (unsigned char *)&alt_ref);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("error [%x], tag [%x]", ret, EXIF_TAG_GPS_ALTITUDE_REF);
- if (ret == MM_ERROR_CAMCORDER_LOW_MEMORY) {
- free(b);
- b = NULL;
- goto exit;
- }
- }
-
- rData.numerator = (unsigned int)(f_altitude + 0.5)*100;
- rData.denominator = 100;
- exif_set_rational(b, exif_data_get_byte_order(ed), rData);
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_ALTITUDE,
- EXIF_FORMAT_RATIONAL, 1, (unsigned char *)b);
- free(b);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_ALTITUDE);
- }
- } else {
- _mmcam_dbg_warn("malloc failed");
- }
- }
-
- /*44. EXIF_TAG_GPS_TIME_STAMP*/
- {
- 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);
- if (gps_timestamp > 0.0) {
- unsigned char *b = NULL;
- unsigned int hour;
- unsigned int min;
- unsigned int microsec;
- ExifRational rData;
-
- hour = (unsigned int)(gps_timestamp / 3600);
- 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);
- b = malloc(3 * sizeof(ExifRational));
- if (b) {
- rData.numerator = hour;
- rData.denominator = 1;
- exif_set_rational(b, exif_data_get_byte_order(ed), rData);
-
- rData.numerator = min;
- rData.denominator = 1;
- exif_set_rational(b + 8, exif_data_get_byte_order(ed), rData);
-
- rData.numerator = microsec;
- rData.denominator = 1000000;
- exif_set_rational(b + 16, exif_data_get_byte_order(ed), rData);
-
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_TIME_STAMP,
- EXIF_FORMAT_RATIONAL, 3, b);
- free(b);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_TIME_STAMP);
- }
- } else {
- _mmcam_dbg_warn( "malloc failed." );
- }
- }
- }
-
- /*45. EXIF_TAG_GPS_DATE_STAMP*/
- {
- unsigned char *date_stamp = NULL;
- int date_stamp_len = 0;
-
- 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);
-
- /* cause it should include NULL char */
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_DATE_STAMP,
- EXIF_FORMAT_ASCII, date_stamp_len + 1, date_stamp);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_DATE_STAMP);
- }
- }
- }
-
- /*46. EXIF_TAG_GPS_PROCESSING_METHOD */
- {
- unsigned char *processing_method = NULL;
- int processing_method_len = 0;
-
- 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);
-
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_GPS, EXIF_TAG_GPS_PROCESSING_METHOD,
- EXIF_FORMAT_UNDEFINED, processing_method_len, processing_method);
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_GPS_PROCESSING_METHOD);
- }
- }
- }
- } else {
- _mmcam_dbg_log( "Tag for GPS is DISABLED." );
- }
-
-
- /*47. EXIF_TAG_MAKER_NOTE*/
- ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_MAKER_NOTE,
- EXIF_FORMAT_UNDEFINED, 8, (unsigned char *)"SAMSUNG");
- if (ret != MM_ERROR_NONE) {
- EXIF_SET_ERR(ret, EXIF_TAG_MAKER_NOTE);
- }
-
- /* create and link samsung maker note */
- ret = mm_exif_mnote_create(ed);
- if (ret != MM_ERROR_NONE){
- EXIF_SET_ERR(ret, EXIF_TAG_MAKER_NOTE);
- } else {
- _mmcam_dbg_log("Samsung makernote created");
-
- /* add samsung maker note entries (param : data, tag, index, subtag index1, subtag index2) */
- ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_MNOTE_VERSION, 0, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
- }
- /*
- ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_DEVICE_ID, 2, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
- }
-
- ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_SERIAL_NUM, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
- }
-
- ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_COLOR_SPACE, 1, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
- }
- */
- ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_FACE_DETECTION, 0, _MNOTE_VALUE_NONE, _MNOTE_VALUE_NONE);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! ret=%x", ret);
- }
- /*
- ret = mm_exif_mnote_set_add_entry(ed, MNOTE_SAMSUNG_TAG_MODEL_ID, _MNOTE_VALUE_NONE, 3, 2);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_exif_mnote_set_add_entry error! [%x]", ret);
- }
- */
- }
+ __mmcamcorder_update_exif_gps(handle, ed);
_mmcam_dbg_log("");
info = hcamcorder->sub_context->info_image;
- __ta__(" GET_IN_CB:VCONFKEY_SETAPPL_SOUND_STATUS_BOOL",
vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &(info->sound_status));
- );
_mmcam_dbg_log("DONE : sound status %d", info->sound_status);
info = hcamcorder->sub_context->info_image;
- __ta__(" GET_IN_CB:mm_sound_volume_get_value",
- mm_sound_volume_get_value(VOLUME_TYPE_MEDIA, &info->volume_level);
- );
+ mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &info->volume_level);
_mmcam_dbg_log("DONE : volume level %d", info->volume_level);
=======================================================================================*/
#include <stdio.h>
#include <stdarg.h>
-#include <sys/stat.h>
-#include <camsrcjpegenc.h>
#include <sys/vfs.h> /* struct statfs */
+#include <sys/stat.h>
#include <gst/video/video-info.h>
#include "mm_camcorder_internal.h"
#include "mm_camcorder_util.h"
+#include "mm_camcorder_sound.h"
#include <mm_util_imgp.h>
/*-----------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
---------------------------------------------------------------------------*/
/* STATIC INTERNAL FUNCTION */
-
+
//static gint skip_mdat(FILE *f);
static guint16 get_language_code(const char *str);
static gchar* str_to_utf8(const gchar *str);
if(!write_tag(f, "loci")) // type
return FALSE;
-
+
FPUTC_CHECK(0, f); // version
if(!write_to_24(f, 0)) // flags
return FALSE;
-
+
if(!write_to_16(f, get_language_code("eng"))) // language
return FALSE;
-
+
str = str_to_utf8("location_name");
-
+
FPUTS_CHECK(str, f); // name
SAFE_FREE(str);
-
+
FPUTC_CHECK('\0', f);
FPUTC_CHECK(0, f); //role
-
+
if(!write_to_32(f, info.longitude)) // Longitude
return FALSE;
-
+
if(!write_to_32(f, info.latitude)) // Latitude
return FALSE;
-
+
if(! write_to_32(f, info.altitude)) // Altitude
return FALSE;
-
+
str = str_to_utf8("Astronomical_body");
FPUTS_CHECK(str, f);//Astronomical_body
SAFE_FREE(str);
-
+
FPUTC_CHECK('\0', f);
-
+
str = str_to_utf8("Additional_notes");
FPUTS_CHECK(str, f); // Additional_notes
SAFE_FREE(str);
-
+
FPUTC_CHECK('\0', f);
-
+
if((current_pos = ftell(f))<0)
{
- _mmcam_dbg_err("ftell() returns negative value");
+ _mmcam_dbg_err("ftell() returns negative value");
return FALSE;
}
-
+
if(! _mmcamcorder_update_size(f, pos, current_pos))
return FALSE;
return TRUE;
}
+void _mmcamcorder_write_Latitude(FILE *f,int degreex10000)
+{
+ bool isNegative = (degreex10000 < 0);
+ char sign = isNegative? '-': '+';
+
+ // Handle the whole part
+ char str[9];
+ int wholePart = 0;
+ int fractionalPart = 0;
+
+ wholePart = degreex10000 / 10000;
+ if (wholePart == 0) {
+ snprintf(str, 5, "%c%.2d.", sign, wholePart);
+ } else {
+ snprintf(str, 5, "%+.2d.", wholePart);
+ }
+
+ // Handle the fractional part
+ fractionalPart = degreex10000 - (wholePart * 10000);
+ if (fractionalPart < 0) {
+ fractionalPart = -fractionalPart;
+ }
+ snprintf(&str[4], 5, "%.4d", fractionalPart);
+
+ // Do not write the null terminator
+ write_tag(f, str);
+
+ return;
+}
+
+
gboolean _mmcamcorder_write_udta(FILE *f, _MMCamcorderLocationInfo info)
{
gint64 current_pos, pos;
_mmcam_dbg_log("");
-
+
if((pos = ftell(f))<0)
{
- _mmcam_dbg_err("ftell() returns negative value");
+ _mmcam_dbg_err("ftell() returns negative value");
return FALSE;
}
-
- if(!write_to_32(f, 0)) //size
+
+ if(!write_to_32(f, 0)) //size
return FALSE;
-
- if(!write_tag(f, "udta")) // type
+
+ if(!write_tag(f, "udta")) // type
return FALSE;
-
+
if(! _mmcamcorder_write_loci(f, info))
return FALSE;
-
+
if((current_pos = ftell(f))<0)
{
_mmcam_dbg_err("ftell() returns negative value");
return FALSE;
}
-
+
if(! _mmcamcorder_update_size(f, pos, current_pos))
return FALSE;
-
return TRUE;
}
}
+int _mmcamcorder_get_file_system_type(const gchar *path, int *file_system_type)
+{
+ struct statfs fs;
+
+ g_assert(path);
+
+ if (!g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+ _mmcam_dbg_log("File(%s) doesn't exist.", path);
+ return -2;
+ }
+
+ if (-1 == statfs(path, &fs)) {
+ _mmcam_dbg_log("statfs failed.(%s)", path);
+ return -1;
+ }
+
+ *file_system_type = (int)fs.f_type;
+
+ return 0;
+}
+
+
int _mmcamcorder_get_file_size(const char *filename, guint64 *size)
{
struct stat buf;
mmf_return_if_fail(hcamcorder);
- if(!hcamcorder->buffer_probes)
- {
- _mmcam_dbg_err("Fail to remove buffer probe, list for buffer probe is NULL");
+ if (!hcamcorder->buffer_probes) {
+ _mmcam_dbg_warn("list for buffer probe is NULL");
+ return;
}
- list = hcamcorder->buffer_probes;
+ _mmcam_dbg_log("start - category : 0x%x", category);
- while(list)
- {
+ list = hcamcorder->buffer_probes;
+ while (list) {
item = list->data;
-
- if(!item)
- {
+ if (!item) {
_mmcam_dbg_err("Remove buffer probe faild, the item is NULL");
- list = g_list_next(list);
- continue;
+ list = g_list_next(list);
+ continue;
}
- if(item->category & category)
- {
-
- if(item->object && GST_IS_PAD(item->object))
- {
- _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]",
- GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category);
- gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
- }
- else
- {
+ if (item->category & category) {
+ if (item->object && GST_IS_PAD(item->object)) {
+ _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]",
+ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category);
+ gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+ } else {
_mmcam_dbg_warn("Remove buffer probe faild, the pad is null or not pad, just remove item from list and free it");
- }
-
- list = g_list_next(list);
+ }
+
+ list = g_list_next(list);
hcamcorder->buffer_probes = g_list_remove(hcamcorder->buffer_probes, item);
SAFE_FREE(item);
- }
- else
- {
+ } else {
_mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
- list = g_list_next(list);
+ list = g_list_next(list);
}
}
- if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
- {
+ if (category == _MMCAMCORDER_HANDLER_CATEGORY_ALL) {
g_list_free(hcamcorder->buffer_probes);
hcamcorder->buffer_probes = NULL;
}
+
+ _mmcam_dbg_log("done");
+
+ return;
}
-void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCategory category)
+
+void _mmcamcorder_remove_one_buffer_probe(MMHandleType handle, void *object)
{
mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
GList *list = NULL;
mmf_return_if_fail(hcamcorder);
- if(!hcamcorder->event_probes)
- {
- _mmcam_dbg_err("Fail to remove event probe, list for event probe is NULL");
+ if (!hcamcorder->buffer_probes) {
+ _mmcam_dbg_warn("list for buffer probe is NULL");
+ return;
}
- list = hcamcorder->event_probes;
+ _mmcam_dbg_log("start - object : %p", object);
- while(list)
- {
+ list = hcamcorder->buffer_probes;
+ while (list) {
item = list->data;
-
- if(!item)
- {
- _mmcam_dbg_err("Remove event probe faild, the item is NULL");
- list = g_list_next(list);
- continue;
+ if (!item) {
+ _mmcam_dbg_err("Remove buffer probe faild, the item is NULL");
+ list = g_list_next(list);
+ continue;
}
- if(item->category & category)
- {
-
- if(item->object && GST_IS_PAD(item->object))
- {
- _mmcam_dbg_log("Remove event probe on [%s:%s] - [ID : %lu], [Category : %x]",
- GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category);
- gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+ if (item->object && item->object == object) {
+ if (GST_IS_PAD(item->object)) {
+ _mmcam_dbg_log("Remove buffer probe on [%s:%s] - [ID : %lu], [Category : %x]",
+ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category);
+ gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+ } else {
+ _mmcam_dbg_warn("Remove buffer probe faild, the pad is null or not pad, just remove item from list and free it");
}
- else
- {
- _mmcam_dbg_warn("Remove event probe faild, the pad is null or not pad, just remove item from list and free it");
- }
-
- list = g_list_next(list);
- hcamcorder->event_probes = g_list_remove(hcamcorder->event_probes, item);
+
+ list = g_list_next(list);
+ hcamcorder->buffer_probes = g_list_remove(hcamcorder->buffer_probes, item);
SAFE_FREE(item);
- }
- else
- {
+
+ break;
+ } else {
_mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
- list = g_list_next(list);
+ list = g_list_next(list);
}
}
- if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
- {
- g_list_free(hcamcorder->event_probes);
- hcamcorder->event_probes = NULL;
- }
+ _mmcam_dbg_log("done");
+
+ return;
}
-void _mmcamcorder_remove_data_probe(MMHandleType handle, _MMCamcorderHandlerCategory category)
+
+void _mmcamcorder_remove_event_probe(MMHandleType handle, _MMCamcorderHandlerCategory category)
{
mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
GList *list = NULL;
mmf_return_if_fail(hcamcorder);
- if(!hcamcorder->data_probes)
- {
- _mmcam_dbg_err("Fail to remove data probe, list for data probe is NULL");
+ if (!hcamcorder->event_probes) {
+ _mmcam_dbg_warn("list for event probe is NULL");
+ return;
}
- list = hcamcorder->data_probes;
+ _mmcam_dbg_log("start - category : 0x%x", category);
- while(list)
- {
+ list = hcamcorder->event_probes;
+ while (list) {
item = list->data;
-
- if(!item)
- {
- _mmcam_dbg_err("Remove data probe faild, the item is NULL");
- list = g_list_next(list);
- continue;
+ if (!item) {
+ _mmcam_dbg_err("Remove event probe faild, the item is NULL");
+ list = g_list_next(list);
+ continue;
}
- if(item->category & category)
- {
-
- if(item->object && GST_IS_PAD(item->object))
- {
- _mmcam_dbg_log("Remove data probe on [%s:%s] - [ID : %lu], [Category : %x]",
- GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category);
- gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+ if (item->category & category) {
+ if (item->object && GST_IS_PAD(item->object)) {
+ _mmcam_dbg_log("Remove event probe on [%s:%s] - [ID : %lu], [Category : %x]",
+ GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category);
+ gst_pad_remove_probe(GST_PAD(item->object), item->handler_id);
+ } else {
+ _mmcam_dbg_warn("Remove event probe faild, the pad is null or not pad, just remove item from list and free it");
}
- else
- {
- _mmcam_dbg_warn("Remove data probe faild, the pad is null or not pad, just remove item from list and free it");
- }
-
- list = g_list_next(list);
- hcamcorder->data_probes = g_list_remove(hcamcorder->data_probes, item);
+
+ list = g_list_next(list);
+ hcamcorder->event_probes = g_list_remove(hcamcorder->event_probes, item);
SAFE_FREE(item);
- }
- else
- {
+ } else {
_mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
- list = g_list_next(list);
+ list = g_list_next(list);
}
}
- if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
- {
- g_list_free(hcamcorder->data_probes);
- hcamcorder->data_probes = NULL;
- }
+ if (category == _MMCAMCORDER_HANDLER_CATEGORY_ALL) {
+ g_list_free(hcamcorder->event_probes);
+ hcamcorder->event_probes = NULL;
+ }
+
+ _mmcam_dbg_log("done");
+
+ return;
}
+
void _mmcamcorder_disconnect_signal(MMHandleType handle, _MMCamcorderHandlerCategory category)
{
mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
mmf_return_if_fail(hcamcorder);
- if(!hcamcorder->signals)
- {
- _mmcam_dbg_err("Fail to disconnect signals, list for signal is NULL");
+ if (!hcamcorder->signals) {
+ _mmcam_dbg_warn("list for signal is NULL");
+ return;
}
- list = hcamcorder->signals;
+ _mmcam_dbg_log("start - category : 0x%x", category);
- while(list)
- {
+ list = hcamcorder->signals;
+ while (list) {
item = list->data;
-
- if(!item)
- {
+ if (!item) {
_mmcam_dbg_err("Fail to Disconnecting signal, the item is NULL");
- list = g_list_next(list);
- continue;
+ list = g_list_next(list);
+ continue;
}
- if(item->category & category)
- {
-
- if(item->object && GST_IS_ELEMENT(item->object))
- {
- if ( g_signal_handler_is_connected ( item->object, item->handler_id ) )
- {
- _mmcam_dbg_log("Disconnect signal from [%s] : [ID : %lu], [Category : %x]",
- GST_OBJECT_NAME(item->object), item->handler_id, item->category);
- g_signal_handler_disconnect ( item->object, item->handler_id );
- }
- else
- {
- _mmcam_dbg_warn("Signal was not connected, cannot disconnect it : [%s] [ID : %lu], [Category : %x]",
- GST_OBJECT_NAME(item->object), item->handler_id, item->category);
+ if (item->category & category) {
+ if (item->object && GST_IS_ELEMENT(item->object)) {
+ if (g_signal_handler_is_connected(item->object, item->handler_id)) {
+ _mmcam_dbg_log("Disconnect signal from [%s] : [ID : %lu], [Category : %x]",
+ GST_OBJECT_NAME(item->object), item->handler_id, item->category);
+ g_signal_handler_disconnect(item->object, item->handler_id);
+ } else {
+ _mmcam_dbg_warn("Signal was not connected, cannot disconnect it : [%s] [ID : %lu], [Category : %x]",
+ GST_OBJECT_NAME(item->object), item->handler_id, item->category);
}
-
- }
- else
- {
+ } else {
_mmcam_dbg_err("Fail to Disconnecting signal, the element is null or not element, just remove item from list and free it");
- }
-
- list = g_list_next(list);
+ }
+
+ list = g_list_next(list);
hcamcorder->signals = g_list_remove(hcamcorder->signals, item);
SAFE_FREE(item);
- }
- else
- {
+ } else {
_mmcam_dbg_log("Skip item : [ID : %lu], [Category : %x] ", item->handler_id, item->category);
- list = g_list_next(list);
+ list = g_list_next(list);
}
}
- if( category == _MMCAMCORDER_HANDLER_CATEGORY_ALL)
- {
+ if (category == _MMCAMCORDER_HANDLER_CATEGORY_ALL) {
g_list_free(hcamcorder->signals);
hcamcorder->signals = NULL;
- }
+ }
+
+ _mmcam_dbg_log("done");
+
+ return;
}
+
void _mmcamcorder_remove_all_handlers(MMHandleType handle, _MMCamcorderHandlerCategory category)
{
mmf_camcorder_t* hcamcorder = MMF_CAMCORDER(handle);
- _mmcam_dbg_log("ENTER");
+ _mmcam_dbg_log("ENTER");
if(hcamcorder->signals)
_mmcamcorder_disconnect_signal((MMHandleType)hcamcorder, category);
- if(hcamcorder->data_probes)
- _mmcamcorder_remove_data_probe((MMHandleType)hcamcorder, category);
if(hcamcorder->event_probes)
- _mmcamcorder_remove_event_probe((MMHandleType)hcamcorder, category);
+ _mmcamcorder_remove_event_probe((MMHandleType)hcamcorder, category);
if(hcamcorder->buffer_probes)
_mmcamcorder_remove_buffer_probe((MMHandleType)hcamcorder, category);
void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_was)
{
int i=0;
- _MMCamcorderSubContext *sc = (_MMCamcorderSubContext *)data;
+ _MMCamcorderSubContext *sc = (_MMCamcorderSubContext *)data;
+
mmf_return_if_fail(sc);
mmf_return_if_fail(sc->element);
- for (i = 0 ; i < _MMCamcorder_PIPELINE_ELEMENT_NUM ; i++) {
+ for (i = 0 ; i < _MMCAMCORDER_PIPELINE_ELEMENT_NUM ; i++) {
if (sc->element[i].gst && (G_OBJECT(sc->element[i].gst) == where_the_object_was)) {
- _mmcam_dbg_log("The element[%d][%p] is finalized", sc->element[i].id, sc->element[i].gst);
+ _mmcam_dbg_warn("The element[%d][%p] is finalized",
+ sc->element[i].id, sc->element[i].gst);
sc->element[i].gst = NULL;
sc->element[i].id = _MMCAMCORDER_NONE;
- break;
+ return;
+ }
+ }
+
+ mmf_return_if_fail(sc->encode_element);
+
+ for (i = 0 ; i < _MMCAMCORDER_ENCODE_PIPELINE_ELEMENT_NUM ; i++) {
+ if (sc->encode_element[i].gst && (G_OBJECT(sc->encode_element[i].gst) == where_the_object_was)) {
+ _mmcam_dbg_warn("The encode element[%d][%p] is finalized",
+ sc->encode_element[i].id, sc->encode_element[i].gst);
+ sc->encode_element[i].gst = NULL;
+ sc->encode_element[i].id = _MMCAMCORDER_ENCODE_NONE;
+ return;
}
}
+
+ _mmcam_dbg_warn("there is no matching element %p", where_the_object_was);
+
+ return;
}
mmf_camcorder_t *hcamcorder = NULL;
mmf_return_val_if_fail(item, FALSE);
+ pthread_mutex_lock(&(item->lock));
+
hcamcorder = MMF_CAMCORDER(item->handle);
- mmf_return_val_if_fail(hcamcorder, FALSE);
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_warn("msg id:%x, item:%p, handle is NULL", item->id, item);
+ goto MSG_CALLBACK_DONE;
+ }
+
/*_mmcam_dbg_log("msg id:%x, msg_cb:%p, msg_data:%p, item:%p", item->id, hcamcorder->msg_cb, hcamcorder->msg_data, item);*/
- _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(hcamcorder);
+ _MMCAMCORDER_LOCK((MMHandleType)hcamcorder);
- /* check delay of CAPTURED message */
- if (item->id == MM_MESSAGE_CAMCORDER_CAPTURED) {
- MMTA_ACUM_ITEM_END(" CAPTURED MESSAGE DELAY", FALSE);
+ /* remove item from msg data */
+ if (hcamcorder->msg_data) {
+ hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
+ } else {
+ _mmcam_dbg_warn("msg_data is NULL but item[%p] will be removed", item);
}
+ _MMCAMCORDER_UNLOCK((MMHandleType)hcamcorder);
+
+ _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(hcamcorder);
+
if ((hcamcorder) && (hcamcorder->msg_cb)) {
hcamcorder->msg_cb(item->id, (MMMessageParamType*)(&(item->param)), hcamcorder->msg_cb_param);
}
_MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(hcamcorder);
- _MMCAMCORDER_LOCK((MMHandleType)hcamcorder);
-
- if (hcamcorder->msg_data) {
- hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
- }
-
+MSG_CALLBACK_DONE:
/* release allocated memory */
if (item->id == MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO) {
MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)item->param.data;
item->param.size = 0;
}
+ pthread_mutex_unlock(&(item->lock));
+ pthread_mutex_destroy(&(item->lock));
+
free(item);
item = NULL;
- _MMCAMCORDER_UNLOCK((MMHandleType)hcamcorder);
-
/* For not being called again */
return FALSE;
}
item = g_malloc(sizeof(_MMCamcorderMsgItem));
memcpy(item, data, sizeof(_MMCamcorderMsgItem));
item->handle = handle;
+ pthread_mutex_init(&(item->lock), NULL);
_MMCAMCORDER_LOCK(handle);
hcamcorder->msg_data = g_list_append(hcamcorder->msg_data, item);
_MMCAMCORDER_LOCK(handle);
- if(!hcamcorder->msg_data)
- {
+ if (!hcamcorder->msg_data) {
_mmcam_dbg_log("No message data is remained.");
- }
- else
- {
+ } else {
list = hcamcorder->msg_data;
- while(list)
- {
+ while (list) {
item = list->data;
- list = g_list_next(list);
+ list = g_list_next(list);
- if(!item)
- {
+ if (!item) {
_mmcam_dbg_err("Fail to remove message. The item is NULL");
- }
- else
- {
- ret = g_idle_remove_by_data (item);
- _mmcam_dbg_log("Remove item[%p]. ret[%d]", item, ret);
-
- hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
-
- SAFE_FREE(item);
+ } else {
+ if (pthread_mutex_trylock(&(item->lock))) {
+ ret = g_idle_remove_by_data (item);
+ _mmcam_dbg_log("Remove item[%p]. ret[%d]", item, ret);
+
+ hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item);
+
+ if (ret ) {
+ /* release allocated memory */
+ if (item->id == MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO) {
+ MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)item->param.data;
+ if (cam_fd_info) {
+ SAFE_FREE(cam_fd_info->face_info);
+ free(cam_fd_info);
+ cam_fd_info = NULL;
+ }
+
+ item->param.data = NULL;
+ item->param.size = 0;
+ }
+
+ pthread_mutex_unlock(&(item->lock));
+ pthread_mutex_destroy(&(item->lock));
+ SAFE_FREE(item);
+ } else {
+ item->handle = 0;
+ _mmcam_dbg_warn("Fail to remove item[%p]", item);
+
+ pthread_mutex_unlock(&item->lock);
+ }
+ } else {
+ _mmcam_dbg_warn("item lock failed. it's being called...");
+ }
}
}
}
-void
-_mmcamcorder_err_trace_write( char *str_filename, char *func_name, int line_num, char *fmt, ... )
-{
- FILE *f = NULL;
- va_list ap = {0};
- char time_string[TIME_STRING_MAX_LEN] = {'\0',};
-
- time_t current_time;
- struct tm new_time;
-
- mmf_return_if_fail( str_filename );
-
- current_time = time( NULL );
- localtime_r( ¤t_time, &new_time );
-
- f = fopen( str_filename, "a" );
- if( f == NULL )
- {
- _mmcam_dbg_warn( "Failed to open file.[%s]", str_filename );
- return;
- }
-
- asctime_r(&new_time, time_string);
- fprintf( f, "[%.19s][%05d][%s]", time_string, line_num, func_name );
-
- va_start( ap, fmt );
- vfprintf( f, fmt, ap );
- va_end( ap );
-
- fprintf( f, "\n" );
-
- fclose( f );
-}
-
int _mmcamcorder_get_pixel_format(GstCaps *caps)
{
const GstStructure *structure;
GstVideoInfo media_info;
MMPixelFormatType type = 0;
unsigned int fourcc = 0;
-
- mmf_return_val_if_fail( caps != NULL, MM_PIXEL_FORMAT_INVALID );
+
+ mmf_return_val_if_fail( caps != NULL, MM_PIXEL_FORMAT_INVALID );
structure = gst_caps_get_structure (caps, 0);
media_type = gst_structure_get_name (structure);
- if (!strcmp (media_type, "image/jpeg") )
- {
+ if (!strcmp (media_type, "image/jpeg") ) {
_mmcam_dbg_log("It is jpeg.");
type = MM_PIXEL_FORMAT_ENCODED;
- }
- else if (!strcmp (media_type, "video/x-raw")
- && gst_video_info_from_caps(&media_info, caps)
- && GST_VIDEO_INFO_IS_YUV(&media_info))
- {
+ } else if (!strcmp (media_type, "video/x-raw") &&
+ gst_video_info_from_caps(&media_info, caps) &&
+ GST_VIDEO_INFO_IS_YUV(&media_info)) {
_mmcam_dbg_log("It is yuv.");
fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info));
type = _mmcamcorder_get_pixtype(fourcc);
- }
- else
- {
+ } else if (!strcmp (media_type, "video/x-raw") &&
+ GST_VIDEO_INFO_IS_RGB(&media_info)) {
+ _mmcam_dbg_log("It is rgb.");
+ type = MM_PIXEL_FORMAT_RGB888;
+ } else if (!strcmp (media_type, "video/x-h264")) {
+ _mmcam_dbg_log("It is H264");
+ type = MM_PIXEL_FORMAT_ENCODED_H264;
+ } else {
_mmcam_dbg_err("Not supported format");
type = MM_PIXEL_FORMAT_INVALID;
}
-
- _mmcam_dbg_log( "Type [%d]", type );
+
+ /*_mmcam_dbg_log( "Type [%d]", type );*/
return type;
}
fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
}
break;
+ case MM_PIXEL_FORMAT_NV21:
+ if (use_zero_copy_format) {
+ fourcc = GST_MAKE_FOURCC ('S', 'N', '2', '1');
+ } else {
+ fourcc = GST_MAKE_FOURCC ('N', 'V', '2', '1');
+ }
+ break;
case MM_PIXEL_FORMAT_YUYV:
if (use_zero_copy_format) {
fourcc = GST_MAKE_FOURCC ('S', 'U', 'Y', 'V');
fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', 'P');
break;
case MM_PIXEL_FORMAT_RGB888:
- fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', '3');
+ fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
break;
case MM_PIXEL_FORMAT_ENCODED:
if (codectype == MM_IMAGE_CODEC_JPEG) {
case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
fourcc = GST_MAKE_FOURCC('I','T','L','V');
break;
+ case MM_PIXEL_FORMAT_ENCODED_H264:
+ fourcc = GST_MAKE_FOURCC('H','2','6','4');
+ break;
default:
_mmcam_dbg_log("Not proper pixel type[%d]. Set default - I420", pixtype);
if (use_zero_copy_format) {
case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
pixtype = MM_PIXEL_FORMAT_NV12;
break;
+ case GST_MAKE_FOURCC ('S', 'N', '2', '1'):
+ case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
+ pixtype = MM_PIXEL_FORMAT_NV21;
+ break;
case GST_MAKE_FOURCC ('S', 'U', 'Y', 'V'):
case GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'):
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
break;
case GST_MAKE_FOURCC ('B', 'G', 'R', 'A'):
case GST_MAKE_FOURCC ('B', 'G', 'R', 'x'):
+ case GST_MAKE_FOURCC ('S', 'R', '3', '2'):
pixtype = MM_PIXEL_FORMAT_RGBA;
break;
case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'):
case GST_MAKE_FOURCC ('I', 'T', 'L', 'V'):
pixtype = MM_PIXEL_FORMAT_ITLV_JPEG_UYVY;
break;
+ case GST_MAKE_FOURCC ('H', '2', '6', '4'):
+ pixtype = MM_PIXEL_FORMAT_ENCODED_H264;
+ break;
default:
- _mmcam_dbg_log("Not supported fourcc type(%x)", fourcc);
+ _mmcam_dbg_log("Not supported fourcc type(%c%c%c%c)",
+ fourcc, fourcc>>8, fourcc>>16, fourcc>>24);
pixtype = MM_PIXEL_FORMAT_INVALID;
break;
}
}
-gboolean
-_mmcamcorder_add_elements_to_bin( GstBin *bin, GList *element_list )
+gboolean _mmcamcorder_add_elements_to_bin(GstBin *bin, GList *element_list)
{
GList *local_list = element_list;
_MMCamcorderGstElement *element = NULL;
- mmf_return_val_if_fail( bin && local_list, FALSE );
+ mmf_return_val_if_fail(bin && local_list, FALSE);
- while( local_list )
- {
+ while (local_list) {
element = (_MMCamcorderGstElement*)local_list->data;
- if( element && element->gst )
- {
- if( !gst_bin_add( bin, GST_ELEMENT(element->gst) ) )
- {
+ if (element && element->gst) {
+ if (!gst_bin_add(bin, GST_ELEMENT(element->gst))) {
_mmcam_dbg_err( "Add element [%s] to bin [%s] FAILED",
GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
GST_ELEMENT_NAME(GST_ELEMENT(bin)) );
return FALSE;
- }
- else
- {
- _mmcam_dbg_log( "Add element [%s] to bin [%s] OK",
- GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
- GST_ELEMENT_NAME(GST_ELEMENT(bin)) );
+ } else {
+ _mmcam_dbg_log("Add element [%s] to bin [%s] OK",
+ GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
+ GST_ELEMENT_NAME(GST_ELEMENT(bin)));
}
}
-
local_list = local_list->next;
}
return TRUE;
}
-gboolean
-_mmcamcorder_link_elements( GList *element_list )
+gboolean _mmcamcorder_link_elements(GList *element_list)
{
GList *local_list = element_list;
_MMCamcorderGstElement *element = NULL;
_MMCamcorderGstElement *pre_element = NULL;
- mmf_return_val_if_fail( local_list, FALSE );
+ mmf_return_val_if_fail(local_list, FALSE);
pre_element = (_MMCamcorderGstElement*)local_list->data;
local_list = local_list->next;
- while( local_list )
- {
+ while (local_list) {
element = (_MMCamcorderGstElement*)local_list->data;
- if( 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)),
- GST_ELEMENT_NAME(GST_ELEMENT(element->gst)) );
- }
- else
- {
- _mmcam_dbg_err( "Link [%s] to [%s] FAILED",
- GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
- GST_ELEMENT_NAME(GST_ELEMENT(element->gst)) );
+ if (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)),
+ GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
+ } else {
+ _mmcam_dbg_err("Link [%s] to [%s] FAILED",
+ GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)),
+ GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
return FALSE;
}
}
}
-gboolean _mmcamcorder_resize_frame(unsigned char *src_data, int src_width, int src_height, int src_length, int src_format,
- unsigned char **dst_data, int *dst_width, int *dst_height, int *dst_length)
+gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_width, unsigned int src_height, unsigned int src_length, int src_format,
+ unsigned char **dst_data, unsigned int *dst_width, unsigned int *dst_height, unsigned int *dst_length)
{
int ret = TRUE;
int mm_ret = MM_ERROR_NONE;
case MM_PIXEL_FORMAT_UYVY:
input_format = MM_UTIL_IMG_FMT_UYVY;
break;
+ case MM_PIXEL_FORMAT_RGB888:
+ input_format = MM_UTIL_IMG_FMT_RGB888;
+ break;
default:
_mmcam_dbg_err("NOT supported format", src_format);
return FALSE;
src_width, src_height, *dst_width, *dst_height);
/* get length of resized image */
- __ta__(" mm_util_get_image_size 2",
- mm_ret = mm_util_get_image_size(input_format, *dst_width, *dst_height, (unsigned int*)dst_length);
- );
+ mm_ret = mm_util_get_image_size(input_format, *dst_width, *dst_height, dst_length);
if (mm_ret != MM_ERROR_NONE) {
GST_ERROR("mm_util_get_image_size failed 0x%x", ret);
return FALSE;
return FALSE;
}
- __ta__(" mm_util_resize_image",
mm_ret = mm_util_resize_image(src_data, src_width, src_height, input_format,
- dst_tmp_data, (unsigned int*)dst_width, (unsigned int*)dst_height);
- );
+ dst_tmp_data, dst_width, dst_height);
if (mm_ret != MM_ERROR_NONE) {
GST_ERROR("mm_util_resize_image failed 0x%x", ret);
free(dst_tmp_data);
gboolean _mmcamcorder_encode_jpeg(void *src_data, unsigned int src_width, unsigned int src_height,
int src_format, unsigned int src_length, unsigned int jpeg_quality,
- void **result_data, unsigned int *result_length)
+ void **result_data, unsigned int *result_length, int enc_type)
{
int ret = 0;
int i = 0;
- int enc_type = JPEG_ENCODER_SOFTWARE;
guint32 src_fourcc = 0;
gboolean do_encode = FALSE;
jpegenc_parameter enc_param;
- static jpegenc_info enc_info = {-1,};
+ jpegenc_info enc_info;
- _mmcam_dbg_log("START");
+ _mmcam_dbg_log("START - enc_type [%d]", enc_type);
mmf_return_val_if_fail(src_data && result_data && result_length, FALSE);
CLEAR(enc_param);
+ CLEAR(enc_info);
- if (enc_info.sw_support == -1) {
- CLEAR(enc_info);
- __ta__("camsrcjpegenc_get_info",
- camsrcjpegenc_get_info(&enc_info);
- );
- }
+ camsrcjpegenc_get_info(&enc_info);
src_fourcc = _mmcamcorder_get_fourcc(src_format, 0, FALSE);
camsrcjpegenc_get_src_fmt(src_fourcc, &(enc_param.src_fmt));
}
/* check H/W encoder */
- if (enc_info.hw_support) {
+ if (enc_info.hw_support && enc_type == JPEG_ENCODER_HARDWARE) {
_mmcam_dbg_log("check H/W encoder supported format list");
/* Check supported format */
for (i = 0 ; i < enc_info.hw_enc.input_fmt_num ; i++) {
src_width, src_height, src_length,
jpeg_quality, enc_type);
- __ta__(" camsrcjpegenc_encode",
ret = camsrcjpegenc_encode(&enc_info, enc_type, &enc_param );
- );
if (ret == CAMSRC_JPEGENC_ERROR_NONE) {
*result_data = enc_param.result_data;
*result_length = enc_param.result_len;
}
+/* make UYVY smaller as multiple size. ex: 640x480 -> 320x240 or 160x120 ... */
+gboolean _mmcamcorder_downscale_UYVYorYUYV(unsigned char *src, unsigned int src_width, unsigned int src_height,
+ unsigned char **dst, unsigned int dst_width, unsigned int dst_height)
+{
+ unsigned int i = 0;
+ int j = 0;
+ int k = 0;
+ int src_index = 0;
+ int ratio_width = 0;
+ int ratio_height = 0;
+ int line_base = 0;
+ int line_width = 0;
+ int jump_width = 0;
+ unsigned char *result = NULL;
+
+ if (src == NULL || dst == NULL) {
+ _mmcam_dbg_err("src[%p] or dst[%p] is NULL", src, dst);
+ return FALSE;
+ }
+
+ result = (unsigned char *)malloc((dst_width * dst_height)<<1);
+ if (!result) {
+ _mmcam_dbg_err("failed to alloc dst data");
+ return FALSE;
+ }
+
+ ratio_width = src_width / dst_width;
+ ratio_height = src_height / dst_height;
+ line_width = src_width << 1;
+ jump_width = ratio_width << 1;
+
+ _mmcam_dbg_warn("[src %dx%d] [dst %dx%d] [line width %d] [ratio width %d, height %d]",
+ src_width, src_height, dst_width, dst_height,
+ line_width, ratio_width, ratio_height);
+
+ for (i = 0 ; i < src_height ; i += ratio_height) {
+ line_base = i * line_width;
+ for (j = 0 ; j < line_width ; j += jump_width) {
+ src_index = line_base + j;
+ result[k++] = src[src_index];
+ result[k++] = src[src_index+1];
+
+ j += jump_width;
+ src_index = line_base + j;
+ if (src_index % 4 == 0) {
+ result[k++] = src[src_index+2];
+ } else {
+ result[k++] = src[src_index];
+ }
+ result[k++] = src[src_index+1];
+ }
+ }
+
+ *dst = result;
+
+ _mmcam_dbg_warn("converting done - result %p", result);
+
+ return TRUE;
+}
+
+gboolean _mmcamcorder_check_file_path(const gchar *path)
+{
+ if(strstr(path, "/opt/usr") != NULL) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
static guint16 get_language_code(const char *str)
{
return (guint16) (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F);
while(*tag)
FPUTC_CHECK(*tag++, f);
- return TRUE;
+ return TRUE;
}
static inline gboolean write_to_32(FILE *f, guint val)
{
FPUTC_CHECK(val >> 8, f);
FPUTC_CHECK(val, f);
- return TRUE;
+ return TRUE;
}
static inline gboolean write_to_24(FILE *f, guint val)
{
write_to_16(f, val >> 8);
FPUTC_CHECK(val, f);
- return TRUE;
+ return TRUE;
+}
+
+void *_mmcamcorder_util_task_thread_func(void *data)
+{
+ int ret = MM_ERROR_NONE;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)data;
+
+ if (!hcamcorder) {
+ _mmcam_dbg_err("handle is NULL");
+ return NULL;
+ }
+
+ _mmcam_dbg_warn("start thread");
+
+ pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+
+ while (hcamcorder->task_thread_state != _MMCAMCORDER_TASK_THREAD_STATE_EXIT) {
+ switch (hcamcorder->task_thread_state) {
+ case _MMCAMCORDER_TASK_THREAD_STATE_NONE:
+ _mmcam_dbg_warn("wait for task signal");
+ pthread_cond_wait(&(hcamcorder->task_thread_cond), &(hcamcorder->task_thread_lock));
+ _mmcam_dbg_warn("task signal received : state %d", hcamcorder->task_thread_state);
+ break;
+ case _MMCAMCORDER_TASK_THREAD_STATE_SOUND_PLAY_START:
+ _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE, FALSE);
+ hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE;
+ break;
+ case _MMCAMCORDER_TASK_THREAD_STATE_ENCODE_PIPE_CREATE:
+ ret = _mmcamcorder_video_prepare_record((MMHandleType)hcamcorder);
+
+ /* Play record start sound */
+ _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_REC_START_SND, FALSE);
+
+ _mmcam_dbg_log("_mmcamcorder_video_prepare_record return 0x%x", ret);
+ hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE;
+ break;
+ default:
+ _mmcam_dbg_warn("invalid task thread state %d", hcamcorder->task_thread_state);
+ hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_EXIT;
+ break;
+ }
+ }
+
+ pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+
+ _mmcam_dbg_warn("exit thread");
+
+ return NULL;
}
| INCLUDE FILES |
=======================================================================================*/
#include <gst/video/cameracontrol.h>
+#include <gst/app/gstappsrc.h>
#include "mm_camcorder_internal.h"
#include "mm_camcorder_videorec.h"
/*---------------------------------------------------------------------------------------
| LOCAL VARIABLE DEFINITIONS for internal |
---------------------------------------------------------------------------------------*/
-#define _MMCAMCORDER_MINIMUM_FRAME 3
+#define _MMCAMCORDER_MINIMUM_FRAME 5
#define _MMCAMCORDER_RETRIAL_COUNT 10
#define _MMCAMCORDER_FRAME_WAIT_TIME 200000 /* ms */
-#define _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL 5
#define _OFFSET_COMPOSITION_MATRIX 40L
+#define _GOP_GEN_INTERVAL 1000000000 /*nano seconds*/
/*---------------------------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
---------------------------------------------------------------------------------------*/
/* STATIC INTERNAL FUNCTION */
+static void __mmcamcorder_video_stream_cb(GstElement *element, GstSample *sample, gpointer u_data);
static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
static GstPadProbeReturn __mmcamcorder_video_dataprobe_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
/*---------------------------------------------------------------------------------------
| GLOBAL FUNCTION DEFINITIONS: |
---------------------------------------------------------------------------------------*/
-int _mmcamcorder_add_recorder_pipeline(MMHandleType handle)
+static void __mmcamcorder_video_stream_cb(GstElement *element, GstSample *sample, gpointer u_data)
{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
+ _MMCamcorderSubContext *sc = NULL;
+
+ GstBuffer *buffer = gst_sample_get_buffer(sample);
+ mmf_return_if_fail(buffer);
+ mmf_return_if_fail(gst_buffer_n_memory(buffer));
+ mmf_return_if_fail(hcamcorder);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+ mmf_return_if_fail(sc);
+
+ /*
+ _mmcam_dbg_log("ENTER - push_encoding_buffer %d, buffer %p, MALLOCDATA %p, size %d",
+ sc->info_video->push_encoding_buffer, buffer, GST_BUFFER_MALLOCDATA(buffer), GST_BUFFER_SIZE(buffer));
+ */
+
+ /* push buffer in appsrc to encode */
+ if (sc->info_video->push_encoding_buffer == PUSH_ENCODING_BUFFER_RUN &&
+ sc->info_video->record_dual_stream &&
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst) {
+ GstFlowReturn ret = 0;
+ GstClock *pipe_clock = NULL;
+ GstPad *capsfilter_pad = NULL;
+
+ if(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+ if(sc->info_video->is_firstframe) {
+ sc->info_video->is_firstframe = FALSE;
+ pipe_clock = GST_ELEMENT_CLOCK(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst);
+ if (pipe_clock) {
+ gst_object_ref(pipe_clock);
+ sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer) - (gst_clock_get_time(pipe_clock) - GST_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst)->base_time);
+ gst_object_unref(pipe_clock);
+ }
+ }
+ } else {
+ if(sc->info_video->is_firstframe) {
+ sc->info_video->is_firstframe = FALSE;
+ sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer);
+ }
+ }
+
+ GST_BUFFER_PTS(buffer) = GST_BUFFER_PTS (buffer) - sc->info_video->base_video_ts;
+
+ capsfilter_pad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+// gst_buffer_set_caps(buffer, gst_pad_get_current_caps(capsfilter_pad));
+ gst_object_unref(capsfilter_pad);
+ capsfilter_pad = NULL;
+
+ ret = gst_app_src_push_buffer((GstAppSrc *)sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, buffer);
+ if (ret != GST_FLOW_OK &&
+ ret != GST_FLOW_FLUSHING) {
+ _mmcam_dbg_err("gst_app_src_push_buffer failed [0x%x]", ret);
+ gst_buffer_unref(buffer);
+ buffer = NULL;
+ }
+
+ /*_mmcam_dbg_log("push buffer result : 0x%x", ret);*/
+ } else {
+ _mmcam_dbg_warn("unref video buffer immediately - push encoding buffer %d",
+ sc->info_video->push_encoding_buffer);
+
+ gst_buffer_unref(buffer);
+ buffer = NULL;
+ }
+
+ return;
+}
+
+
+int _mmcamcorder_create_recorder_pipeline(MMHandleType handle)
+{
+ int i = 0;
int err = MM_ERROR_NONE;
int audio_disable = FALSE;
- char* gst_element_rsink_name = NULL;
+ const char* gst_element_rsink_name = NULL;
+ GstBus *bus = NULL;
GstPad *srcpad = NULL;
GstPad *sinkpad = NULL;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
-
- _mmcam_dbg_log("");
- err = _mmcamcorder_check_videocodec_fileformat_compatibility( handle );
- if( err != MM_ERROR_NONE )
- {
+ _mmcam_dbg_warn("start");
+
+ err = _mmcamcorder_check_videocodec_fileformat_compatibility(handle);
+ if (err != MM_ERROR_NONE) {
return err;
}
- /* Create gstreamer element */
- /* Check main pipeline */
- if (!sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
+ /* Main pipeline */
+ if(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
+ _mmcam_dbg_log("pipeline is exist so need to remove pipeline _MMCAMCORDER_ENCODE_MAIN_PIPE = %p",
+ sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
+ _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
}
+ _MMCAMCORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, "recorder_pipeline", err);
+
/* get audio disable */
mm_camcorder_get_attributes(handle, NULL,
MMCAM_AUDIO_DISABLE, &audio_disable,
sc->audio_disable, sc->is_modified_rate, audio_disable);
if (sc->audio_disable == FALSE) {
- /* Sub pipeline */
- __ta__(" __mmcamcorder_create_audiosrc_bin",
+ /* create audiosrc bin */
err = _mmcamcorder_create_audiosrc_bin((MMHandleType)hcamcorder);
- );
if (err != MM_ERROR_NONE) {
return err;
}
-
- gst_bin_add(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
}
- __ta__(" _mmcamcorder_create_encodesink_bin",
err = _mmcamcorder_create_encodesink_bin((MMHandleType)hcamcorder, MM_CAMCORDER_ENCBIN_PROFILE_VIDEO);
- );
if (err != MM_ERROR_NONE) {
return err;
}
- gst_bin_add(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+ if (sc->audio_disable == FALSE) {
+ gst_bin_add(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
+ }
+
+ /* add element and encodesink bin to encode main pipeline */
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst,
+ sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst,
+ NULL);
- /* Link each element */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0");
+ /* Link each element : appsrc - capsfilter - encodesink bin */
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "sink");
+ _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_FILT].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0");
_MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
if (sc->audio_disable == FALSE) {
- srcpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
- sinkpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
+ srcpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
+ sinkpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
_MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
}
- _mmcamcorder_conf_get_element(hcamcorder->conf_main,
+ _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_RECORD,
"RecordsinkElement",
&RecordsinkElement);
/* set data probe function for audio */
if (sc->audio_disable == FALSE) {
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "sink");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "sink");
MMCAMCORDER_ADD_BUFFER_PROBE(sinkpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_audioque_dataprobe, hcamcorder);
gst_object_unref(sinkpad);
sinkpad = NULL;
-
+
/* for voice mute */
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_audio_dataprobe_audio_mute, hcamcorder);
gst_object_unref(srcpad);
srcpad = NULL;
- if (sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "src");
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "src");
MMCAMCORDER_ADD_EVENT_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_eventprobe_monitor, hcamcorder);
gst_object_unref(srcpad);
}
}
- if (sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "src");
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "src");
MMCAMCORDER_ADD_EVENT_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_eventprobe_monitor, hcamcorder);
gst_object_unref(srcpad);
}
if (sc->audio_disable) {
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "sink");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "sink");
MMCAMCORDER_ADD_BUFFER_PROBE(sinkpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_video_dataprobe_audio_disable, hcamcorder);
gst_object_unref(sinkpad);
}
if (!strcmp(gst_element_rsink_name, "filesink")) {
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "src");
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC].gst, "src");
MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_video_dataprobe_record, hcamcorder);
gst_object_unref(srcpad);
srcpad = NULL;
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
MMCAMCORDER_ADD_BUFFER_PROBE(srcpad, _MMCAMCORDER_HANDLER_VIDEOREC,
__mmcamcorder_audio_dataprobe_check, hcamcorder);
gst_object_unref(srcpad);
srcpad = NULL;
}
+ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
+
+ /* register pipeline message callback */
+ hcamcorder->encode_pipeline_cb_event_id = gst_bus_add_watch(bus, (GstBusFunc)_mmcamcorder_pipeline_cb_message, hcamcorder);
+
+ gst_object_unref(bus);
+ bus = NULL;
+
return MM_ERROR_NONE;
pipeline_creation_error:
+ for (i = _MMCAMCORDER_AUDIOSRC_BIN ; i <= _MMCAMCORDER_ENCSINK_SINK ; i++) {
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, i);
+ }
+ _MMCAMCORDER_ELEMENT_REMOVE(sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE);
return err;
}
int _mmcamcorder_remove_audio_pipeline(MMHandleType handle)
{
- int ret = MM_ERROR_NONE;
GstPad *srcpad = NULL;
GstPad *sinkpad = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_mmcam_dbg_log("");
- if (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst != NULL) {
- __ta__( " AudiosrcBin Set NULL",
- ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, GST_STATE_NULL);
- );
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Faile to change audio source state[%d]", ret);
- return ret;
- }
-
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
+ if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst != NULL) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
_MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
- gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
+ /* release audiosrc bin */
+ gst_bin_remove(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst);
/*
To avoid conflicting between old elements and newly created elements,
It's because the pipeline of audio recording destroys at the same time,
and '_mmcamcorder_element_release_noti' will perfom removing handle.
*/
- _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_AUDIOSRC_BIN, _MMCAMCORDER_AUDIOSRC_NS);
+ _mmcamcorder_remove_element_handle(handle, (void *)sc->encode_element, _MMCAMCORDER_AUDIOSRC_BIN, _MMCAMCORDER_AUDIOSRC_VOL);
_mmcam_dbg_log("Audio pipeline removed");
}
}
-int _mmcamcorder_remove_encoder_pipeline(MMHandleType handle)
+int _mmcamcorder_remove_encode_pipeline(MMHandleType handle)
{
- int ret = MM_ERROR_NONE;
- GstPad *srcpad = NULL;
- GstPad *sinkpad = NULL;
GstPad *reqpad = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
-
+
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
_mmcam_dbg_log("");
- if (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst != NULL) {
- __ta__( " EncodeBin Set NULL",
- ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, GST_STATE_NULL);
- );
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("Faile to change encode bin state[%d]", ret);
- return ret;
- }
-
- srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_BIN].gst, "src1");
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0");
- _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad);
-
+ if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst != NULL) {
/* release request pad */
- reqpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
+ reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio");
if (reqpad) {
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+ gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
gst_object_unref(reqpad);
reqpad = NULL;
}
- reqpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
+ reqpad = gst_element_get_static_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "video");
if (reqpad) {
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
+ gst_element_release_request_pad(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, reqpad);
gst_object_unref(reqpad);
reqpad = NULL;
}
- gst_bin_remove(GST_BIN(sc->element[_MMCAMCORDER_MAIN_PIPE].gst),
- sc->element[_MMCAMCORDER_ENCSINK_BIN].gst);
+ /* release encode main pipeline */
+ gst_object_unref(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst);
/*
To avoid conflicting between old elements and newly created elements,
It's because the pipeline of audio recording destroys at the same time,
and '_mmcamcorder_element_release_noti' will perfom removing handle.
*/
- _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_AUDIOSRC_QUE, _MMCAMCORDER_AUDIOSRC_ENC); /* Encode bin has audio encoder too. */
- _mmcamcorder_remove_element_handle(handle, _MMCAMCORDER_ENCSINK_BIN, _MMCAMCORDER_ENCSINK_SINK);
+ //_mmcamcorder_remove_element_handle(handle, (void *)sc->encode_element, _MMCAMCORDER_ENCODE_MAIN_PIPE, _MMCAMCORDER_ENCSINK_SINK);
_mmcam_dbg_log("Encoder pipeline removed");
}
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
+ GstBus *bus = NULL;
+
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
- _mmcam_dbg_log("");
+ _mmcam_dbg_log("start");
- if (!sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
+ if (!sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst) {
_mmcam_dbg_warn("pipeline is not existed.");
return MM_ERROR_NONE;
}
_mmcamcorder_remove_all_handlers((MMHandleType)hcamcorder, _MMCAMCORDER_HANDLER_VIDEOREC);
+ 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 [0x%x]", ret);
+ return ret;
+ }
+
+ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst));
+
/* remove audio pipeline first */
ret = _mmcamcorder_remove_audio_pipeline(handle);
if (ret != MM_ERROR_NONE) {
return ret;
}
- ret = _mmcamcorder_remove_encoder_pipeline(handle);
+ ret = _mmcamcorder_remove_encode_pipeline(handle);
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_err("Fail to remove encoder pipeline");
return ret;
}
- return ret;
-}
-
-
-void _mmcamcorder_destroy_video_pipeline(MMHandleType handle)
-{
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
- _MMCamcorderSubContext *sc = NULL;
- GstPad *reqpad1 = NULL;
- GstPad *reqpad2 = NULL;
-
- mmf_return_if_fail(hcamcorder);
- sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-
- mmf_return_if_fail(sc);
- mmf_return_if_fail(sc->element);
-
- _mmcam_dbg_log("");
-
- if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
- _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_NULL);
+ /* Remove pipeline message callback */
+ if (hcamcorder->encode_pipeline_cb_event_id != 0) {
+ g_source_remove(hcamcorder->encode_pipeline_cb_event_id);
+ hcamcorder->encode_pipeline_cb_event_id = 0;
+ }
- _mmcamcorder_remove_all_handlers((MMHandleType)hcamcorder, _MMCAMCORDER_HANDLER_CATEGORY_ALL);
+ /* Remove remained message */
+ if (bus) {
+ GstMessage *gst_msg = NULL;
+ while ((gst_msg = gst_bus_pop(bus)) != NULL) {
+ _mmcamcorder_pipeline_cb_message(bus, gst_msg, (gpointer)hcamcorder);
+ gst_message_unref(gst_msg);
+ gst_msg = NULL;
+ }
+ gst_object_unref(bus);
+ bus = NULL;
+ }
- reqpad1 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src0");
- reqpad2 = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, "src1");
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad1);
- gst_element_release_request_pad(sc->element[_MMCAMCORDER_VIDEOSRC_TEE].gst, reqpad2);
- gst_object_unref(reqpad1);
- gst_object_unref(reqpad2);
+ _mmcam_dbg_log("done");
- /* object disposing problem happen. */
- _mmcam_dbg_log("Reference count of pipeline(%d)", GST_OBJECT_REFCOUNT_VALUE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst));
- gst_object_unref(sc->element[_MMCAMCORDER_MAIN_PIPE].gst);
- }
+ return ret;
}
int fileformat = 0;
int ret = MM_ERROR_NONE;
double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
- char *temp_filename = NULL;
char *err_name = NULL;
+ char *temp_filename = NULL;
+ GstCameraControl *CameraControl = NULL;
+ GstCameraControlChannel *CameraControlChannel = NULL;
+ const GList *controls = NULL;
+ const GList *item = NULL;
gint fps = 0;
GstElement *pipeline = NULL;
- GstPad *pad = NULL;
_MMCamcorderVideoInfo *info = NULL;
_MMCamcorderSubContext *sc = NULL;
case _MMCamcorder_CMD_RECORD:
{
if (_mmcamcorder_get_state((MMHandleType)hcamcorder) != MM_CAMCORDER_STATE_PAUSED) {
+ /**
+ * start recording
+ */
guint imax_size = 0;
guint imax_time = 0;
int ret_free_space = 0;
char *dir_name = NULL;
guint64 free_space = 0;
+ int file_system_type = 0;
/* Recording */
- _mmcam_dbg_log("Record Start");
+ _mmcam_dbg_log("Record Start - dual stream %d", info->support_dual_stream);
- /* set hybrid mode when ITLV format */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- _mmcam_dbg_log("flush cache TRUE");
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", TRUE);
- }
-
- /* flush queue */
- 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);
-
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
- if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_VIDEO_COMMAND;
- }
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
-
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_RECORD,
- "DropVideoFrame",
- &(sc->drop_vframe));
-
- _mmcamcorder_conf_get_value_int(hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_RECORD,
- "PassFirstVideoFrame",
- &(sc->pass_first_vframe));
-
- _mmcam_dbg_log("Drop video frame count[%d], Pass fisrt video frame count[%d]",
- sc->drop_vframe, sc->pass_first_vframe);
+ /* init record_dual_stream */
+ info->record_dual_stream = FALSE;
ret = mm_camcorder_get_attributes(handle, &err_name,
MMCAM_CAMERA_FPS, &fps,
- MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
+ MMCAM_CAMERA_WIDTH, &(info->preview_width),
+ MMCAM_CAMERA_HEIGHT, &(info->preview_height),
+ MMCAM_VIDEO_WIDTH, &(info->video_width),
+ MMCAM_VIDEO_HEIGHT, &(info->video_height),
MMCAM_FILE_FORMAT, &fileformat,
MMCAM_TARGET_FILENAME, &temp_filename, &size,
MMCAM_TARGET_MAX_SIZE, &imax_size,
MMCAM_TARGET_TIME_LIMIT, &imax_time,
MMCAM_FILE_FORMAT, &(info->fileformat),
+ MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate,
NULL);
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret);
goto _ERR_CAMCORDER_VIDEO_COMMAND;
}
+ if (temp_filename == NULL) {
+ _mmcam_dbg_err("filename is not set");
+ ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+
+ /* set max size */
+ if (imax_size <= 0) {
+ info->max_size = 0; /* do not check */
+ } else {
+ info->max_size = ((guint64)imax_size) << 10; /* to byte */
+ }
+
+ /* set max time */
+ if (imax_time <= 0) {
+ info->max_time = 0; /* do not check */
+ } else {
+ info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
+ }
+
dir_name = g_path_get_dirname(temp_filename);
if (dir_name) {
ret_free_space = _mmcamcorder_get_freespace(dir_name, &free_space);
- _mmcam_dbg_warn("current space for recording - %s : [%" G_GUINT64_FORMAT "]",
- dir_name, free_space);
+ _mmcam_dbg_warn("current space - %s [%" G_GUINT64_FORMAT "]", dir_name, free_space);
+
+ if (_mmcamcorder_get_file_system_type(dir_name, &file_system_type) == 0) {
+ /* MSDOS_SUPER_MAGIC : 0x4d44 */
+ if (file_system_type == MSDOS_SUPER_MAGIC &&
+ (info->max_size == 0 || info->max_size > FAT32_FILE_SYSTEM_MAX_SIZE)) {
+ _mmcam_dbg_warn("FAT32 and too large max[%"G_GUINT64_FORMAT"], set max as %"G_GUINT64_FORMAT,
+ info->max_size, FAT32_FILE_SYSTEM_MAX_SIZE);
+ info->max_size = FAT32_FILE_SYSTEM_MAX_SIZE;
+ } else {
+ _mmcam_dbg_warn("file system 0x%x, max size %"G_GUINT64_FORMAT,
+ file_system_type, info->max_size);
+ }
+ } else {
+ _mmcam_dbg_warn("_mmcamcorder_get_file_system_type failed");
+ }
g_free(dir_name);
dir_name = NULL;
return MM_ERROR_OUT_OF_STORAGE;
}
- /* Play record start sound */
- _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_START_SND, TRUE);
+ pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+ if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst == NULL &&
+ hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_NONE) {
+ /* Play record start sound */
+ _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_START_SND, FALSE);
+ }
+ pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
- /* set max size */
- if (imax_size <= 0) {
- info->max_size = 0; /* do not check */
+ _mmcam_dbg_warn("video size [%dx%d]", info->video_width, info->video_height);
+
+ if (info->video_width == 0 || info->video_height == 0) {
+ _mmcam_dbg_warn("video size is invalid [%dx%d] use preview size [%dx%d]",
+ info->video_width, info->video_height, info->preview_width, info->preview_height);
+ info->video_width = info->preview_width;
+ info->video_height = info->preview_height;
+ }
+
+ if (info->support_dual_stream) {
+ _mmcam_dbg_warn("DUAL STREAM MODE");
+
+ info->record_dual_stream = TRUE;
+
+ /* No need to restart preview */
+ info->restart_preview = FALSE;
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "video-width", info->video_width);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "video-height", info->video_height);
+ } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+ info->preview_width == info->video_width &&
+ info->preview_height == info->video_height) {
+ _mmcam_dbg_log("H264 preview mode and same resolution");
+
+ /* No need to restart preview */
+ info->restart_preview = FALSE;
} else {
- info->max_size = ((guint64)imax_size) << 10; /* to byte */
+ /* always need to restart preview */
+ info->restart_preview = TRUE;
}
- /* set max time */
- if (imax_time <= 0) {
- info->max_time = 0; /* do not check */
+ if (info->restart_preview) {
+ /* stop preview and set new size */
+ _mmcam_dbg_log("restart preview");
+
+ 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);
+
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+
+ if (!_mmcamcorder_set_camera_resolution(handle, info->video_width, info->video_height)) {
+ ret = MM_ERROR_CAMCORDER_INTERNAL;
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+
+ /* Start preview again with new setting */
+ ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+
+ if (motion_rate < 1.0) {
+ _mmcam_dbg_warn("wait for stabilization of frame");
+ usleep(300000);
+ }
} else {
- info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */
+ _mmcam_dbg_log("no need to restart preview");
}
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_RECORD,
+ "DropVideoFrame",
+ &(sc->drop_vframe));
+
+ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_RECORD,
+ "PassFirstVideoFrame",
+ &(sc->pass_first_vframe));
+
+ _mmcam_dbg_log("Drop video frame count[%d], Pass fisrt video frame count[%d]",
+ sc->drop_vframe, sc->pass_first_vframe);
+
+ info->record_drop_count = (guint)motion_rate;
+ info->record_motion_rate = motion_rate;
if (sc->is_modified_rate) {
info->record_timestamp_ratio = (_MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE/motion_rate);
- _mmcam_dbg_log("high speed recording fps:%d, slow_rate:%f, timestamp_ratio:%f",
- fps, motion_rate, info->record_timestamp_ratio);
} else {
info->record_timestamp_ratio = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
- _mmcam_dbg_log("normal recording");
}
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", TRUE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "req-negotiation", TRUE);
+ _mmcam_dbg_warn("recording fps %d, motion rate %f, timestamp_ratio %f",
+ fps, info->record_motion_rate, info->record_timestamp_ratio);
- ret =_mmcamcorder_add_recorder_pipeline((MMHandleType)hcamcorder);
- if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_VIDEO_COMMAND;
- }
+ /* set push buffer flag */
+ info->push_encoding_buffer = PUSH_ENCODING_BUFFER_INIT;
+ info->base_video_ts = 0;
- info->filename = strdup(temp_filename);
- if (!info->filename) {
- _mmcam_dbg_err("strdup was failed");
- goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ /* connect video stream cb signal */
+ /*130826 Connect video stream cb for handling fast record frame cb*/
+ if (info->record_dual_stream) {
+ if (_mmcamcorder_connect_video_stream_cb_signal((MMHandleType)hcamcorder) != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
}
- _mmcam_dbg_log("Record start : set file name using attribute - %s ",info->filename);
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", 0);
-
- /* Adjust display FPS */
- sc->display_interval = 0;
- sc->previous_slot_time = 0;
+ /* start video stream */
+ if (info->record_dual_stream) {
+ GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control) {
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+ _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_START");
+ gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_START);
+#endif /* LATEST_CAMERA_CONTROL */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+ } else {
+ _mmcam_dbg_err("could not get camera control");
+ }
+ }
- /* gst_element_set_base_time(GST_ELEMENT(pipeline), (GstClockTime)0);
- if you want to use audio clock, enable this block
- for change recorder_pipeline state to paused. */
- __ta__(" _MMCamcorder_CMD_RECORD:GST_STATE_PAUSED2",
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
- );
- if (ret != MM_ERROR_NONE) {
- /* Remove recorder pipeline and recording file which size maybe zero */
- __ta__(" record fail:remove_recorder_pipeline",
- _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
- );
- if (info->filename) {
- _mmcam_dbg_log("file delete(%s)", info->filename);
- unlink(info->filename);
- g_free(info->filename);
- info->filename = NULL;
+ /* check pre-created encode pipeline */
+ pthread_mutex_lock(&(hcamcorder->task_thread_lock));
+ if (sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst == NULL &&
+ hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_NONE) {
+ /* create encoding pipeline */
+ ret =_mmcamcorder_video_prepare_record((MMHandleType)hcamcorder);
+ if (ret != MM_ERROR_NONE) {
+ pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
}
- goto _ERR_CAMCORDER_VIDEO_COMMAND;
}
+ pthread_mutex_unlock(&(hcamcorder->task_thread_lock));
+
+ /* check recording start sound */
+ _mmcamcorder_sound_solo_play_wait(handle);
/**< To fix video recording hanging
1. use gst_element_set_start_time() instead of gst_pipeline_set_new_stream_time()
basetime wouldn't change if you set (GstClockTime)0.
3. Move set start time position below PAUSED of pipeline.
*/
- gst_element_set_start_time(GST_ELEMENT(pipeline), (GstClockTime)1);
+ //gst_element_set_start_time(GST_ELEMENT(sc->element[_MMCAMCORDER_MAIN_PIPE].gst), (GstClockTime)1);
+ //gst_element_set_start_time(GST_ELEMENT(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst), (GstClockTime)1);
+
info->video_frame_count = 0;
+ info->is_firstframe = TRUE;
info->audio_frame_count = 0;
info->filesize = 0;
sc->ferror_send = FALSE;
sc->error_occurs = FALSE;
sc->bget_eos = FALSE;
- __ta__(" _MMCamcorder_CMD_RECORD:GST_STATE_PLAYING2",
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- );
+ ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PLAYING);
if (ret != MM_ERROR_NONE) {
+ /* stop video stream */
+ if (info->record_dual_stream) {
+ GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control) {
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+ _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP");
+ gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP);
+#endif /* LATEST_CAMERA_CONTROL */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+ } else {
+ _mmcam_dbg_err("failed to get camera control");
+ }
+ }
+
/* Remove recorder pipeline and recording file which size maybe zero */
- __ta__(" record fail:remove_recorder_pipeline",
_mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
- );
if (info->filename) {
_mmcam_dbg_log("file delete(%s)", info->filename);
unlink(info->filename);
- g_free(info->filename);
- info->filename = NULL;
}
goto _ERR_CAMCORDER_VIDEO_COMMAND;
}
+
+ /*set the camera control to create the GOP so that video record will get a new key frame*/
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+ GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ controls = gst_camera_control_list_channels(CameraControl);
+ if (controls != NULL) {
+ for (item = controls ; item && item->data ; item = item->next) {
+ CameraControlChannel = item->data;
+ _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+ if (!strcmp(CameraControlChannel->label, "new-gop")) {
+ //gst_camera_control_set_value(CameraControl, CameraControlChannel, 1);
+ break;
+ }
+ }
+
+ if (item == NULL) {
+ _mmcam_dbg_warn("failed to find new-gop control channel");
+ }
+ }
+ } else {
+ _mmcam_dbg_warn("Can't cast Video source into camera control or not H264 prevew format[%d]",
+ sc->info_image->preview_format);
+ }
} else {
/* Resume case */
- int video_enc = 0;
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", FALSE);
-
- mm_camcorder_get_attributes(handle, NULL, MMCAM_VIDEO_ENCODER, &video_enc, NULL);
- if (video_enc == MM_VIDEO_CODEC_MPEG4) {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "force-intra", TRUE);
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 &&
+ GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ /* generate and I-frame on resuming */
+ CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ controls = gst_camera_control_list_channels(CameraControl);
+ if (controls != NULL) {
+ for (item = controls ; item && item->data ; item = item->next) {
+ CameraControlChannel = item->data;
+ _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label);
+ if (!strcmp(CameraControlChannel->label, "new-gop")) {
+ //gst_camera_control_set_value(CameraControl, CameraControlChannel, 1);
+ break;
+ }
+ }
+
+ if (item == NULL) {
+ _mmcam_dbg_warn("failed to find new-gop control channel");
+ }
+ }
}
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", FALSE);
+
_mmcam_dbg_log("Object property settings done");
}
}
usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
}
}
- /* tee block */
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", TRUE);
+ /* block encodebin */
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "runtime-pause", TRUE);
break;
}
case _MMCamcorder_CMD_CANCEL:
return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
}
- 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);
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", FALSE);
-
- __ta__(" _MMCamcorder_CMD_CANCEL:GST_STATE_READY",
- ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
- );
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ /* block push buffer */
+ info->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
+ ret = _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
if (ret != MM_ERROR_NONE) {
goto _ERR_CAMCORDER_VIDEO_COMMAND;
}
- __ta__(" __mmcamcorder_remove_recorder_pipeline",
- _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
- );
+ /* stop video stream */
+ if (info->record_dual_stream) {
+ GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control) {
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+ _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP");
+ gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP);
+#endif /* LATEST_CAMERA_CONTROL */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+ } else {
+ _mmcam_dbg_err("failed to get camera control");
+ }
+ }
+
+ if (info->restart_preview) {
+ /* restart preview */
+ 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);
+
+ ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+
+ /* reset restart_preview for inset window layout */
+ info->restart_preview = FALSE;
+
+ ret = _mmcamcorder_set_camera_resolution(handle, info->preview_width, info->preview_height);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+
+ ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_VIDEO_COMMAND;
+ }
+ }
/* remove target file */
if (info->filename) {
_mmcam_dbg_log("file delete(%s)", info->filename);
unlink(info->filename);
- g_free(info->filename);
- info->filename = NULL;
}
sc->isMaxsizePausing = FALSE;
sc->previous_slot_time = 0;
info->video_frame_count = 0;
info->audio_frame_count = 0;
- info->filesize =0;
-
- /* set flush cache as FALSE */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", FALSE);
- }
-
- __ta__(" _MMCamcorder_CMD_CANCEL:GST_STATE_PLAYING",
- ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- );
- if (ret != MM_ERROR_NONE) {
- goto _ERR_CAMCORDER_VIDEO_COMMAND;
- }
+ info->filesize = 0;
break;
}
case _MMCamcorder_CMD_COMMIT:
} else {
_mmcam_dbg_log("_MMCamcorder_CMD_COMMIT : start");
info->b_commiting = TRUE;
+ sc->bget_eos = FALSE;
}
for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) {
}
}
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", FALSE);
-
- if (sc->error_occurs) {
- GstPad *video= NULL;
- GstPad *audio = NULL;
- int ret = 0;
-
- _mmcam_dbg_err("Committing Error case");
-
- video = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "sink");
- ret = gst_pad_send_event (video, gst_event_new_eos());
- _mmcam_dbg_err("Sending EOS video sink : %d", ret);
- gst_object_unref(video);
-
- video = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "src");
- gst_pad_push_event (video, gst_event_new_flush_start());
- gst_pad_push_event (video, gst_event_new_flush_stop(TRUE));
- ret = gst_pad_push_event (video, gst_event_new_eos());
- _mmcam_dbg_err("Sending EOS video encoder src pad : %d", ret);
- gst_object_unref(video);
-
- if (sc->audio_disable == FALSE) {
- audio = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src");
- gst_pad_push_event (audio, gst_event_new_flush_start());
- gst_pad_push_event (audio, gst_event_new_flush_stop(TRUE));
- ret = gst_element_send_event(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
- _mmcam_dbg_err("Sending EOS audio encoder src pad : %d", ret);
- gst_object_unref(audio);
- }
- } else {
- if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst != NULL) {
- ret = gst_element_send_event(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, gst_event_new_eos());
- _mmcam_dbg_warn("send eos to videosrc result : %d", ret);
- }
-
- if (sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst != NULL) {
- pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, "src");
- ret = gst_element_send_event(sc->element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
- gst_object_unref(pad);
- pad = NULL;
+ /* block push buffer */
+ info->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
+ _mmcam_dbg_log("block push buffer to appsrc");
- _mmcam_dbg_warn("send eos to audiosrc result : %d", ret);
- }
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst != NULL) {
+ ret = gst_element_send_event(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, gst_event_new_eos());
+ _mmcam_dbg_warn("send eos to appsrc result : %d", ret);
}
- if (hcamcorder->quick_device_close) {
- _mmcam_dbg_warn("quick_device_close");
- /* close device quickly */
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "quick-device-close",TRUE);
+ if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst != NULL) {
+ ret = gst_element_send_event(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
+ _mmcam_dbg_warn("send eos to audiosrc result : %d", ret);
}
/* sc */
/* Wait EOS */
_mmcam_dbg_log("Start to wait EOS");
ret =_mmcamcorder_get_eos_message(handle);
-
- /* set flush cache as FALSE */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "flush-cache", FALSE);
- }
-
if (ret != MM_ERROR_NONE) {
info->b_commiting = FALSE;
goto _ERR_CAMCORDER_VIDEO_COMMAND;
return MM_ERROR_NONE;
_ERR_CAMCORDER_VIDEO_COMMAND:
- if (ret != MM_ERROR_NONE && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst != NULL) {
- int op_status = 0;
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "operation-status", &op_status);
- _mmcam_dbg_err("Current Videosrc status[0x%x]", op_status);
+ if (command == _MMCamcorder_CMD_RECORD) {
+ _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
}
return ret;
int enabletag = 0;
guint64 file_size = 0;
- GstPad *pad = NULL;
- GstElement *pipeline = NULL;
-
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
_MMCamcorderVideoInfo *info = NULL;
_mmcam_dbg_err("");
- MMTA_ACUM_ITEM_BEGIN(" _mmcamcorder_video_handle_eos", 0);
+ if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
+ /* Play record stop sound */
+ _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND, FALSE);
+ } else {
+ _mmcam_dbg_warn("Play stop sound through pulseaudio");
+
+#ifdef _MMCAMCORDER_UPLOAD_SAMPLE
+ _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND);
+#else /* _MMCAMCORDER_UPLOAD_SAMPLE */
+ _mmcamcorder_sound_init(handle);
+#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
- pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
+ _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, TRUE);
+
+ _mmcamcorder_sound_finalize(handle);
+ }
/* remove blocking part */
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
- 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);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
mm_camcorder_get_attributes(handle, NULL,
MMCAM_TAG_ENABLE, &enabletag,
NULL);
- _mmcam_dbg_log("Set state of pipeline as PAUSED");
- __ta__(" _MMCamcorder_CMD_COMMIT:GST_STATE_PAUSED",
- ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
- );
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:GST_STATE_READY or PAUSED failed. error[%x]", ret);
- }
-
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
-
- __ta__(" _MMCamcorder_CMD_COMMIT:__mmcamcorder_remove_recorder_pipeline",
ret = _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
- );
if (ret != MM_ERROR_NONE) {
_mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:__mmcamcorder_remove_recorder_pipeline failed. error[%x]", ret);
}
+ /* stop video stream */
+ if (info->record_dual_stream) {
+ GstCameraControl *control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control) {
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", TRUE);
+#ifdef LATEST_CAMERA_CONTROL
+ _mmcam_dbg_log("GST_CAMERA_CONTROL_RECORD_COMMAND_STOP");
+ gst_camera_control_set_record_command(control, GST_CAMERA_CONTROL_RECORD_COMMAND_STOP);
+#endif /* LATEST_CAMERA_CONTROL */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "stop-video", FALSE);
+ } else {
+ _mmcam_dbg_err("failed to get camera control");
+ }
+ }
+
if (enabletag && !(sc->ferror_send)) {
- __ta__( " _MMCamcorder_CMD_COMMIT:__mmcamcorder_add_locationinfo",
ret = __mmcamcorder_add_locationinfo((MMHandleType)hcamcorder, info->fileformat);
- );
if (ret) {
_mmcam_dbg_log("Writing location information SUCCEEDED !!");
} else {
}
}
- /* Flush EOS event to avoid pending pipeline */
- _mmcam_dbg_log("Flush EOS event");
- pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "sink");
- gst_pad_push_event(pad, gst_event_new_flush_start());
- gst_pad_push_event(pad, gst_event_new_flush_stop(TRUE));
- gst_object_unref(pad);
- pad = NULL;
-
- pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "src");
- gst_pad_push_event(pad, gst_event_new_flush_start());
- gst_pad_push_event(pad, gst_event_new_flush_stop(TRUE));
- gst_object_unref(pad);
- pad = NULL;
-
- _mmcam_dbg_log("Set state as PLAYING");
- __ta__(" _MMCamcorder_CMD_COMMIT:GST_STATE_PLAYING",
- ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
- );
- /* Do not return when error is occurred.
- Recording file was created successfully, but starting pipeline failed */
- if (ret != MM_ERROR_NONE) {
- msg.id = MM_MESSAGE_CAMCORDER_ERROR;
- msg.param.code = ret;
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- _mmcam_dbg_err("Failed to set state PLAYING[%x]", ret);
- }
+ if (info->restart_preview) {
+ /* block queue */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE);
- if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
- /* Play record stop sound */
- __ta__(" _MMCamcorder_CMD_COMMIT:_mmcamcorder_sound_solo_play",
- _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND, TRUE);
- );
+ _mmcam_dbg_log("Set state of pipeline as READY");
+ ret = _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY);
+
+ /* unblock queue */
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE);
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE);
+ if (ret != MM_ERROR_NONE) {
+ msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+ msg.param.code = ret;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ _mmcam_dbg_err("Failed to set state READY[%x]", ret);
+ }
+
+ /* reset restart_preview for inset window layout */
+ info->restart_preview = FALSE;
+
+ /* recover preview size */
+ _mmcamcorder_set_camera_resolution(handle, info->preview_width, info->preview_height);
+
+ ret =_mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING);
+ /* Do not return when error is occurred.
+ Recording file was created successfully, but starting pipeline failed */
+ if (ret != MM_ERROR_NONE) {
+ msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+ msg.param.code = ret;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ _mmcam_dbg_err("Failed to set state PLAYING[%x]", ret);
+ }
} else {
- _mmcam_dbg_log("Do NOT play recording stop sound because of ASM stop");
+ _mmcam_dbg_log("No need to restart preview");
}
/* Send recording report to application */
info->video_frame_count = 0;
info->audio_frame_count = 0;
info->filesize = 0;
- g_free(info->filename);
- info->filename = NULL;
info->b_commiting = FALSE;
- MMTA_ACUM_ITEM_END(" _mmcamcorder_video_handle_eos", 0);
- MMTA_ACUM_ITEM_END("Real Commit Time", 0);
+ if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) {
+ /* check recording stop sound */
+ _mmcamcorder_sound_solo_play_wait(handle);
+ }
_mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end");
* @remarks
* @see
*/
-static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
-{
- GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info);
+static GstPadProbeReturn __mmcamcorder_eventprobe_monitor(GstPad *pad, GstPadProbeInfo *info, gpointer u_data){
+ GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info);
switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_UNKNOWN:
/* upstream events */
case GST_EVENT_NAVIGATION:
case GST_EVENT_LATENCY:
/* downstream serialized events */
- case GST_EVENT_SEGMENT :
+ case GST_EVENT_SEGMENT :
case GST_EVENT_TAG:
case GST_EVENT_BUFFERSIZE:
_mmcam_dbg_log("[%s:%s] gots %s", GST_DEBUG_PAD_NAME(pad), GST_EVENT_TYPE_NAME(event));
break;
}
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
static GstPadProbeReturn __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- GstMapInfo mapinfo;
- guint64 size;
- gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
- size = mapinfo.size;
- gst_buffer_unmap(buffer, &mapinfo);
-
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstMapInfo mapinfo;
_MMCamcorderSubContext *sc = NULL;
- _MMCamcorderVideoInfo *videoinfo = NULL;
+ _MMCamcorderVideoInfo *videoinfo = NULL;
+ _MMCamcorderMsgItem msg;
+ guint64 buffer_size = 0;
+ guint64 trailer_size = 0;
- mmf_return_val_if_fail(hcamcorder, TRUE);
- mmf_return_val_if_fail(buffer, FALSE);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
- mmf_return_val_if_fail(sc && sc->info_video, TRUE);
- videoinfo = sc->info_video;
+ mmf_return_val_if_fail(sc && sc->info_video, GST_PAD_PROBE_OK);
+ videoinfo = sc->info_video;
+
+ /* get buffer size */
+ if (!gst_buffer_map(buffer, &mapinfo, GST_MAP_READ)) {
+ _mmcam_dbg_warn("map failed : buffer %p", buffer);
+ return GST_PAD_PROBE_OK;
+ }
- /*_mmcam_dbg_err("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));*/
+ buffer_size = mapinfo.size;
+ gst_buffer_unmap(buffer, &mapinfo);
- if (videoinfo->audio_frame_count == 0) {
- videoinfo->filesize += size;
- videoinfo->audio_frame_count++;
- return GST_PAD_PROBE_OK;
+ /*_mmcam_dbg_err("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/
+
+ pthread_mutex_lock(&(videoinfo->size_check_lock));
+
+ if (videoinfo->audio_frame_count == 0) {
+ videoinfo->filesize += buffer_size;
+ videoinfo->audio_frame_count++;
+ return GST_PAD_PROBE_OK;
}
if (sc->ferror_send || sc->isMaxsizePausing) {
_mmcam_dbg_warn("Recording is paused, drop frames");
- return GST_PAD_PROBE_DROP;
+ pthread_mutex_unlock(&(videoinfo->size_check_lock));
+ return GST_PAD_PROBE_DROP;
+ }
+
+ /* get trailer size */
+ if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+ } else {
+ trailer_size = 0;
+ }
+
+ /* check max size of recorded file */
+ if (videoinfo->max_size > 0 &&
+ videoinfo->max_size < videoinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
+ GstState pipeline_state = GST_STATE_VOID_PENDING;
+ GstElement *pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
+ _mmcam_dbg_warn("Max size!!! Recording is paused.");
+ _mmcam_dbg_warn("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \
+ " buffer size : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]",
+ videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size);
+
+ if (!sc->isMaxsizePausing) {
+ sc->isMaxsizePausing = TRUE;
+ gst_element_get_state(pipeline, &pipeline_state, NULL, -1) ;
+ if (pipeline_state == GST_STATE_PLAYING) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ }
+
+ msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ }
+
+ pthread_mutex_unlock(&(videoinfo->size_check_lock));
+
+ return FALSE;
}
- videoinfo->filesize += size;
- videoinfo->audio_frame_count++;
+ videoinfo->filesize += buffer_size;
+ videoinfo->audio_frame_count++;
+
+ pthread_mutex_unlock(&(videoinfo->size_check_lock));
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
static GstPadProbeReturn __mmcamcorder_video_dataprobe_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
{
- static int count = 0;
gint ret = 0;
guint vq_size = 0;
guint aq_size = 0;
guint64 trailer_size = 0;
guint64 queued_buffer = 0;
char *filename = NULL;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- GstMapInfo mapinfo;
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstMapInfo mapinfo;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
_MMCamcorderMsgItem msg;
_MMCamcorderSubContext *sc = NULL;
- _MMCamcorderVideoInfo *videoinfo = NULL;
+ _MMCamcorderVideoInfo *videoinfo = NULL;
- mmf_return_val_if_fail(hcamcorder, TRUE);
- mmf_return_val_if_fail(buffer, FALSE);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
- mmf_return_val_if_fail(sc && sc->info_video, TRUE);
- videoinfo = sc->info_video;
+ mmf_return_val_if_fail(sc && sc->info_video, GST_PAD_PROBE_OK);
+ videoinfo = sc->info_video;
- /*_mmcam_dbg_log("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));*/
+ /*_mmcam_dbg_log("[%" GST_TIME_FORMAT "]", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/
if (sc->ferror_send) {
_mmcam_dbg_warn("file write error, drop frames");
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
- gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
- buffer_size = mapinfo.size;
- gst_buffer_unmap(buffer, &mapinfo);
- videoinfo->video_frame_count++;
- if (videoinfo->video_frame_count <= (guint64)_MMCAMCORDER_MINIMUM_FRAME) {
+ gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
+ buffer_size = mapinfo.size;
+ gst_buffer_unmap(buffer, &mapinfo);
+
+ videoinfo->video_frame_count++;
+ if (videoinfo->video_frame_count <= (guint64)_MMCAMCORDER_MINIMUM_FRAME) {
/* _mmcam_dbg_log("Pass minimum frame: info->video_frame_count: %" G_GUINT64_FORMAT " ",
info->video_frame_count); */
- videoinfo->filesize += buffer_size;
- return GST_PAD_PROBE_OK;
+ pthread_mutex_lock(&(videoinfo->size_check_lock));
+ videoinfo->filesize += buffer_size;
+ pthread_mutex_unlock(&(videoinfo->size_check_lock));
+ return GST_PAD_PROBE_OK;
}
/* get trailer size */
- if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+ if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
} else {
trailer_size = 0;
}
- /* to minimizing free space check overhead */
- count = count % _MMCAMCORDER_FREE_SPACE_CHECK_INTERVAL;
- if (count++ == 0) {
- filename = videoinfo->filename;
- ret = _mmcamcorder_get_freespace(filename, &free_space);
+ filename = videoinfo->filename;
+ ret = _mmcamcorder_get_freespace(filename, &free_space);
- /*_mmcam_dbg_log("check free space for recording");*/
+ /*_mmcam_dbg_log("check free space for recording");*/
- switch (ret) {
- case -2: /* file not exist */
- case -1: /* failed to get free space */
- _mmcam_dbg_err("Error occured. [%d]", ret);
- if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
- sc->ferror_send = TRUE;
- msg.id = MM_MESSAGE_CAMCORDER_ERROR;
- if (ret == -2) {
- msg.param.code = MM_ERROR_FILE_NOT_FOUND;
- } else {
- msg.param.code = MM_ERROR_FILE_READ;
- }
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ switch (ret) {
+ case -2: /* file not exist */
+ case -1: /* failed to get free space */
+ _mmcam_dbg_err("Error occured. [%d]", ret);
+ if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
+ sc->ferror_send = TRUE;
+ msg.id = MM_MESSAGE_CAMCORDER_ERROR;
+ if (ret == -2) {
+ msg.param.code = MM_ERROR_FILE_NOT_FOUND;
} else {
- sc->ferror_count++;
- }
-
- return GST_PAD_PROBE_REMOVE; /* skip this buffer */
- break;
- default: /* succeeded to get free space */
- /* check free space for recording */
- /* get queued buffer size */
- if (sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size);
- }
- if (sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size);
+ msg.param.code = MM_ERROR_FILE_READ;
}
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ } else {
+ sc->ferror_count++;
+ }
- queued_buffer = aq_size + vq_size;
+ return GST_PAD_PROBE_DROP; /* skip this buffer */
+ break;
+ default: /* succeeded to get free space */
+ /* check free space for recording */
+ /* get queued buffer size */
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size);
+ }
+ if (sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size);
+ }
- /* check free space */
- if (free_space < (_MMCAMCORDER_MINIMUM_SPACE + buffer_size + trailer_size + queued_buffer)) {
- _mmcam_dbg_warn("No more space for recording!!! Recording is paused.");
- _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]," \
- " buffer size : [%" G_GUINT64_FORMAT "], queued buffer size : [%" G_GUINT64_FORMAT "]", \
- free_space, trailer_size, buffer_size, queued_buffer);
+ queued_buffer = aq_size + vq_size;
- if (!sc->isMaxsizePausing) {
- MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
- sc->isMaxsizePausing = TRUE;
+ /* check free space */
+ if (free_space < (_MMCAMCORDER_MINIMUM_SPACE + buffer_size + trailer_size + queued_buffer)) {
+ _mmcam_dbg_warn("No more space for recording!!! Recording is paused.");
+ _mmcam_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]," \
+ " buffer size : [%" G_GUINT64_FORMAT "], queued buffer size : [%" G_GUINT64_FORMAT "]", \
+ free_space, trailer_size, buffer_size, queued_buffer);
- msg.id = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
- _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
- }
+ if (!sc->isMaxsizePausing) {
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ sc->isMaxsizePausing = TRUE;
- return GST_PAD_PROBE_DROP;
+ msg.id = MM_MESSAGE_CAMCORDER_NO_FREE_SPACE;
+ _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
}
- break;
+
+ return GST_PAD_PROBE_DROP;
}
+ break;
}
+ pthread_mutex_lock(&(videoinfo->size_check_lock));
+
/* check max size of recorded file */
- if (videoinfo->max_size > 0 &&
- videoinfo->max_size < videoinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
+ if (videoinfo->max_size > 0 &&
+ videoinfo->max_size < videoinfo->filesize + buffer_size + trailer_size + _MMCAMCORDER_MMS_MARGIN_SPACE) {
GstState pipeline_state = GST_STATE_VOID_PENDING;
GstElement *pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
_mmcam_dbg_warn("Max size!!! Recording is paused.");
_mmcam_dbg_warn("Max size : [%" G_GUINT64_FORMAT "], current file size : [%" G_GUINT64_FORMAT "]," \
" buffer size : [%" G_GUINT64_FORMAT "], trailer size : [%" G_GUINT64_FORMAT "]",
- videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size);
+ videoinfo->max_size, videoinfo->filesize, buffer_size, trailer_size);
if (!sc->isMaxsizePausing) {
+ sc->isMaxsizePausing = TRUE;
gst_element_get_state(pipeline, &pipeline_state, NULL, -1) ;
if (pipeline_state == GST_STATE_PLAYING) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
- sc->isMaxsizePausing = TRUE;
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
}
msg.id = MM_MESSAGE_CAMCORDER_MAX_SIZE;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
}
- return GST_PAD_PROBE_DROP;
+ pthread_mutex_unlock(&(videoinfo->size_check_lock));
+
+ return GST_PAD_PROBE_DROP;
}
- videoinfo->filesize += buffer_size;
+ videoinfo->filesize += (guint64)buffer_size;
+
+ /*
+ _mmcam_dbg_log("filesize %lld Byte, ", videoinfo->filesize);
+ */
- _mmcam_dbg_log("filesize %lld Byte, ", videoinfo->filesize);
+ pthread_mutex_unlock(&(videoinfo->size_check_lock));
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
_MMCamcorderMsgItem msg;
_MMCamcorderSubContext *sc = NULL;
- _MMCamcorderVideoInfo *videoinfo = NULL;
+ _MMCamcorderVideoInfo *videoinfo = NULL;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- mmf_return_val_if_fail(buffer, FALSE);
- mmf_return_val_if_fail(hcamcorder, TRUE);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
- mmf_return_val_if_fail(sc, TRUE);
- mmf_return_val_if_fail(sc->info_video, TRUE);
+ mmf_return_val_if_fail(sc, GST_PAD_PROBE_OK);
+ mmf_return_val_if_fail(sc->info_video, GST_PAD_PROBE_OK);
- videoinfo = sc->info_video;
+ videoinfo = sc->info_video;
- b_time = GST_BUFFER_TIMESTAMP(buffer);
+ b_time = GST_BUFFER_PTS(buffer);
rec_pipe_time = GST_TIME_AS_MSECONDS(b_time);
- if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+ if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
} else {
trailer_size = 0;
}
/* check max time */
- if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
+ if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
_mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
- rec_pipe_time, videoinfo->max_time);
+ rec_pipe_time, videoinfo->max_time);
if (!sc->isMaxtimePausing) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
sc->isMaxtimePausing = TRUE;
msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
- msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+ msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
msg.param.recording_status.remained_time = 0;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
}
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
/* calculate remained time can be recorded */
- if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
- remained_time = videoinfo->max_time - rec_pipe_time;
- } else if (videoinfo->max_size > 0) {
- long double max_size = (long double)videoinfo->max_size;
- long double current_size = (long double)(videoinfo->filesize + trailer_size);
+ if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
+ remained_time = videoinfo->max_time - rec_pipe_time;
+ } else if (videoinfo->max_size > 0) {
+ long double max_size = (long double)videoinfo->max_size;
+ long double current_size = (long double)(videoinfo->filesize + trailer_size);
remained_time = (unsigned int)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
}
msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
- msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+ msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
msg.param.recording_status.remained_time = remained_time;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ /*
_mmcam_dbg_log("time [%" GST_TIME_FORMAT "], size [%d]",
GST_TIME_ARGS(rec_pipe_time), msg.param.recording_status.filesize);
+ */
+
+ if (videoinfo->record_timestamp_ratio != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
+ guint record_motion_rate = (guint)videoinfo->record_motion_rate;
- if (videoinfo->record_timestamp_ratio != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
- GST_BUFFER_TIMESTAMP(buffer) = b_time * (videoinfo->record_timestamp_ratio);
+ /*
+ _mmcam_dbg_log("record_motion_rate %d, videoinfo->record_drop_count %d",
+ record_motion_rate, videoinfo->record_drop_count);
+ */
+
+ /* drop some frame if fast motion */
+ if (videoinfo->record_motion_rate > _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) {
+ if (record_motion_rate != (videoinfo->record_drop_count++)) {
+ /*
+ _mmcam_dbg_warn("drop frame");
+ */
+ return GST_PAD_PROBE_DROP;
+ }
+
+ videoinfo->record_drop_count = 1;
+ /*
+ _mmcam_dbg_warn("pass frame");
+ */
+ }
+
+ GST_BUFFER_PTS(buffer) = b_time * (videoinfo->record_timestamp_ratio);
}
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
+
static GstPadProbeReturn __mmcamcorder_audioque_dataprobe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
{
_MMCamcorderMsgItem msg;
guint64 trailer_size = 0;
guint64 rec_pipe_time = 0;
_MMCamcorderSubContext *sc = NULL;
- GstElement *pipeline = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data);
- _MMCamcorderVideoInfo *videoinfo = NULL;
+ _MMCamcorderVideoInfo *videoinfo = NULL;
unsigned int remained_time = 0;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- mmf_return_val_if_fail(buffer, FALSE);
- mmf_return_val_if_fail(hcamcorder, TRUE);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_OK);
sc = MMF_CAMCORDER_SUBCONTEXT(u_data);
- mmf_return_val_if_fail(sc, TRUE);
- mmf_return_val_if_fail(sc->info_video, TRUE);
- mmf_return_val_if_fail(sc->element, TRUE);
+ mmf_return_val_if_fail(sc, GST_PAD_PROBE_OK);
+ mmf_return_val_if_fail(sc->info_video, GST_PAD_PROBE_OK);
+ mmf_return_val_if_fail(sc->element, GST_PAD_PROBE_OK);
- videoinfo = sc->info_video;
- pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
+ videoinfo = sc->info_video;
- if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(buffer))) {
+ if (!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_PTS(buffer))) {
_mmcam_dbg_err( "Buffer timestamp is invalid, check it");
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
- rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_TIMESTAMP(buffer));
+ rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_PTS(buffer));
- if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
- MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
+ if (videoinfo->fileformat == MM_FILE_FORMAT_3GP || videoinfo->fileformat == MM_FILE_FORMAT_MP4) {
+ MMCAMCORDER_G_OBJECT_GET(sc->encode_element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
} else {
trailer_size = 0;
}
/* calculate remained time can be recorded */
- if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
- remained_time = videoinfo->max_time - rec_pipe_time;
- } else if (videoinfo->max_size > 0) {
- long double max_size = (long double)videoinfo->max_size;
- long double current_size = (long double)(videoinfo->filesize + trailer_size);
+ if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time)) {
+ remained_time = videoinfo->max_time - rec_pipe_time;
+ } else if (videoinfo->max_size > 0) {
+ long double max_size = (long double)videoinfo->max_size;
+ long double current_size = (long double)(videoinfo->filesize + trailer_size);
remained_time = (unsigned long long)((long double)rec_pipe_time * (max_size/current_size)) - rec_pipe_time;
}
- if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
+ if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
_mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \
- rec_pipe_time, videoinfo->max_time);
+ rec_pipe_time, videoinfo->max_time);
if (!sc->isMaxtimePausing) {
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
sc->isMaxtimePausing = TRUE;
msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
- msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+ msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
msg.param.recording_status.remained_time = 0;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
}
- return GST_PAD_PROBE_DROP;
+ return GST_PAD_PROBE_DROP;
}
msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS;
msg.param.recording_status.elapsed = (unsigned long long)rec_pipe_time;
- msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
+ msg.param.recording_status.filesize = (unsigned long long)((videoinfo->filesize + trailer_size) >> 10);
msg.param.recording_status.remained_time = remained_time;
_mmcamcroder_send_message((MMHandleType)hcamcorder, &msg);
+ /*
_mmcam_dbg_log("audio data probe :: time [%" GST_TIME_FORMAT "], size [%lld KB]",
GST_TIME_ARGS(rec_pipe_time), msg.param.recording_status.filesize);
+ */
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
int channel = 0;
int err = MM_ERROR_UNKNOWN;
char *err_name = NULL;
- GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
- GstMapInfo mapinfo = GST_MAP_INFO_INIT;
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
+ GstMapInfo mapinfo = GST_MAP_INFO_INIT;
- mmf_return_val_if_fail(buffer, FALSE);
- mmf_return_val_if_fail(hcamcorder, FALSE);
+ mmf_return_val_if_fail(buffer, GST_PAD_PROBE_DROP);
+ mmf_return_val_if_fail(hcamcorder, GST_PAD_PROBE_DROP);
- /*_mmcam_dbg_log("AUDIO SRC time stamp : [%" GST_TIME_FORMAT "] \n", GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)));*/
+ /*_mmcam_dbg_log("AUDIO SRC time stamp : [%" GST_TIME_FORMAT "] \n", GST_TIME_ARGS(GST_BUFFER_PTS(buffer)));*/
err = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_name,
MMCAM_AUDIO_VOLUME, &volume,
MMCAM_AUDIO_FORMAT, &format,
SAFE_FREE(err_name);
return err;
}
+ gst_buffer_map(buffer, &mapinfo, GST_MAP_READWRITE);
/* Set audio stream NULL */
if (volume == 0.0) {
- gst_buffer_map(buffer, &mapinfo, GST_MAP_WRITE);
- memset(mapinfo.data, 0, mapinfo.size);
- gst_buffer_unmap(buffer, &mapinfo);
+ memset(mapinfo.data, 0, mapinfo.size);
}
/* CALL audio stream callback */
- gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
- if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) {
+ if (hcamcorder->astream_cb && buffer && mapinfo.data && mapinfo.size > 0) {
MMCamcorderAudioStreamDataType stream;
if (_mmcamcorder_get_state((MMHandleType)hcamcorder) < MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_warn("Not ready for stream callback");
- gst_buffer_unmap(buffer, &mapinfo);
- return GST_PAD_PROBE_OK;
+ gst_buffer_unmap(buffer, &mapinfo);
+ return GST_PAD_PROBE_OK;
}
/*_mmcam_dbg_log("Call video steramCb, data[%p], Width[%d],Height[%d], Format[%d]",
GST_BUFFER_DATA(buffer), width, height, format);*/
- stream.data = (void *)mapinfo.data;
+ stream.data = (void *)mapinfo.data;
stream.format = format;
stream.channel = channel;
- stream.length = mapinfo.size;
- stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000); /* nano -> milli second */
+ stream.length = mapinfo.size;
+ stream.timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano -> milli second */
_MMCAMCORDER_LOCK_ASTREAM_CALLBACK(hcamcorder);
_MMCAMCORDER_UNLOCK_ASTREAM_CALLBACK(hcamcorder);
}
- gst_buffer_unmap(buffer, &mapinfo);
- return GST_PAD_PROBE_OK;
+ gst_buffer_unmap(buffer, &mapinfo);
+ return GST_PAD_PROBE_OK;
}
gdouble altitude = 0;
int err = 0;
int orientation = 0;
+ int gps_enable = 0;
char *err_name = NULL;
char err_msg[MAX_ERROR_MESSAGE_LEN] = {'\0',};
_MMCamcorderLocationInfo location_info = {0,};
MMCAM_TAG_LONGITUDE, &longitude,
MMCAM_TAG_ALTITUDE, &altitude,
MMCAM_TAG_VIDEO_ORIENTATION, &orientation,
+ MMCAM_TAG_GPS_ENABLE, &gps_enable,
NULL);
if (err_name) {
_mmcam_dbg_warn("Get tag attrs fail. (%s:%x)", err_name, err);
goto fail;
}
- if (!_mmcamcorder_write_loci(f, location_info)) {
- goto fail;
+ if (gps_enable) {
+ if (!_mmcamcorder_write_loci(f, location_info)) {
+ goto fail;
+ }
}
current_pos = ftell(f);
fclose(f);
return FALSE;
}
+
+
+int _mmcamcorder_connect_video_stream_cb_signal(MMHandleType handle)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+ _MMCamcorderSubContext *sc = 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);
+
+ /* check video source element */
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) {
+ _mmcam_dbg_warn("connect video stream cb signal to _MMCAMCORDER_VIDEOSRC_SRC");
+ MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst,
+ _MMCAMCORDER_HANDLER_VIDEOREC, "video-stream-cb",
+ G_CALLBACK(__mmcamcorder_video_stream_cb),
+ hcamcorder);
+ return MM_ERROR_NONE;
+ } else {
+ _mmcam_dbg_err("videosrc element is not created yet");
+ return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
+ }
+}
+
+
+int _mmcamcorder_video_prepare_record(MMHandleType handle)
+{
+ int ret = MM_ERROR_NONE;
+
+ _MMCamcorderVideoInfo *info = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ mmf_return_val_if_fail(sc->info_video, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ info = sc->info_video;
+
+ _mmcam_dbg_warn("start");
+
+ /* create encoding pipeline */
+ ret =_mmcamcorder_create_recorder_pipeline((MMHandleType)hcamcorder);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_PREPARE_RECORD;
+ }
+
+ if (info->filename == NULL) {
+ char *temp_filename = NULL;
+ int size = 0;
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_TARGET_FILENAME, &temp_filename, &size,
+ NULL);
+ if (temp_filename) {
+ info->filename = strdup(temp_filename);
+ }
+
+ if (!info->filename) {
+ _mmcam_dbg_err("strdup[src:%p] was failed", temp_filename);
+ goto _ERR_PREPARE_RECORD;
+ }
+ }
+
+ _mmcam_dbg_log("Record file name [%s]", info->filename);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", info->filename);
+ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", 0);
+
+ /* Adjust display FPS */
+ sc->display_interval = 0;
+ sc->previous_slot_time = 0;
+
+ ret = _mmcamcorder_gst_set_state(handle, sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PAUSED);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_PREPARE_RECORD;
+ }
+
+ _mmcam_dbg_warn("done");
+
+ return ret;
+
+_ERR_PREPARE_RECORD:
+ /* Remove recorder pipeline and recording file which size maybe zero */
+ _mmcamcorder_remove_recorder_pipeline((MMHandleType)hcamcorder);
+ if (info && info->filename) {
+ _mmcam_dbg_log("file delete(%s)", info->filename);
+ unlink(info->filename);
+ }
+
+ return ret;
+}
+++ /dev/null
-ELF Header:
- Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
- Class: ELF32
- Data: 2's complement, little endian
- Version: 1 (current)
- OS/ABI: UNIX - System V
- ABI Version: 0
- Type: DYN (Shared object file)
- Machine: ARM
- Version: 0x1
- Entry point address: 0x3bd0
- Start of program headers: 52 (bytes into file)
- Start of section headers: 55684 (bytes into file)
- Flags: 0x5000002, has entry point, Version5 EABI
- Size of this header: 52 (bytes)
- Size of program headers: 32 (bytes)
- Number of program headers: 4
- Size of section headers: 40 (bytes)
- Number of section headers: 24
- Section header string table index: 23
-
-Section Headers:
- [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
- [ 0] NULL 00000000 000000 000000 00 0 0 0
- [ 1] .hash HASH 000000b4 0000b4 000684 04 A 2 0 4
- [ 2] .dynsym DYNSYM 00000738 000738 000da0 10 A 3 2 4
- [ 3] .dynstr STRTAB 000014d8 0014d8 00170d 00 A 0 0 1
- [ 4] .gnu.version VERSYM 00002be6 002be6 0001b4 02 A 2 0 2
- [ 5] .gnu.version_r VERNEED 00002d9c 002d9c 000040 00 A 3 2 4
- [ 6] .rel.dyn REL 00002ddc 002ddc 000500 08 A 2 0 4
- [ 7] .rel.plt REL 000032dc 0032dc 000388 08 A 2 9 4
- [ 8] .init PROGBITS 00003664 003664 00000c 00 AX 0 0 4
- [ 9] .plt PROGBITS 00003670 003670 000560 04 AX 0 0 4
- [10] .text PROGBITS 00003bd0 003bd0 006fa4 00 AX 0 0 4
- [11] .fini PROGBITS 0000ab74 00ab74 000008 00 AX 0 0 4
- [12] .rodata PROGBITS 0000ab7c 00ab7c 0020e4 00 A 0 0 4
- [13] .eh_frame PROGBITS 0000cc60 00cc60 000004 00 A 0 0 4
- [14] .init_array INIT_ARRAY 00015000 00d000 000004 00 WA 0 0 4
- [15] .fini_array FINI_ARRAY 00015004 00d004 000004 00 WA 0 0 4
- [16] .jcr PROGBITS 00015008 00d008 000004 00 WA 0 0 4
- [17] .data.rel.ro PROGBITS 0001500c 00d00c 000540 00 WA 0 0 4
- [18] .dynamic DYNAMIC 0001554c 00d54c 000130 08 WA 3 0 4
- [19] .got PROGBITS 0001567c 00d67c 00020c 04 WA 0 0 4
- [20] .data PROGBITS 00015888 00d888 000004 00 WA 0 0 4
- [21] .bss NOBITS 0001588c 00d88c 0000bc 00 WA 0 0 4
- [22] .ARM.attributes ARM_ATTRIBUTES 00000000 00d88c 000031 00 0 0 1
- [23] .shstrtab STRTAB 00000000 00d8bd 0000c6 00 0 0 1
-Key to Flags:
- W (write), A (alloc), X (execute), M (merge), S (strings)
- I (info), L (link order), G (group), x (unknown)
- O (extra OS processing required) o (OS specific), p (processor specific)
-
-There are no section groups in this file.
-
-Program Headers:
- Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
- LOAD 0x000000 0x00000000 0x00000000 0x0cc64 0x0cc64 R E 0x8000
- LOAD 0x00d000 0x00015000 0x00015000 0x0088c 0x00948 RW 0x8000
- DYNAMIC 0x00d54c 0x0001554c 0x0001554c 0x00130 0x00130 RW 0x4
- GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
-
- Section to Segment mapping:
- Segment Sections...
- 00 .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
- 01 .init_array .fini_array .jcr .data.rel.ro .dynamic .got .data .bss
- 02 .dynamic
- 03
-
-Dynamic section at offset 0xd54c contains 34 entries:
- Tag Type Name/Value
- 0x00000001 (NEEDED) Shared library: [libgstreamer-0.10.so.0]
- 0x00000001 (NEEDED) Shared library: [libgobject-2.0.so.0]
- 0x00000001 (NEEDED) Shared library: [libgmodule-2.0.so.0]
- 0x00000001 (NEEDED) Shared library: [libdl.so.2]
- 0x00000001 (NEEDED) Shared library: [libgthread-2.0.so.0]
- 0x00000001 (NEEDED) Shared library: [libpthread.so.0]
- 0x00000001 (NEEDED) Shared library: [librt.so.1]
- 0x00000001 (NEEDED) Shared library: [libglib-2.0.so.0]
- 0x00000001 (NEEDED) Shared library: [libm.so.6]
- 0x00000001 (NEEDED) Shared library: [libc.so.6]
- 0x0000000e (SONAME) Library soname: [libgstinterfaces-0.10.so.0]
- 0x0000000c (INIT) 0x3664
- 0x0000000d (FINI) 0xab74
- 0x00000019 (INIT_ARRAY) 0x15000
- 0x0000001b (INIT_ARRAYSZ) 4 (bytes)
- 0x0000001a (FINI_ARRAY) 0x15004
- 0x0000001c (FINI_ARRAYSZ) 4 (bytes)
- 0x00000004 (HASH) 0xb4
- 0x00000005 (STRTAB) 0x14d8
- 0x00000006 (SYMTAB) 0x738
- 0x0000000a (STRSZ) 5901 (bytes)
- 0x0000000b (SYMENT) 16 (bytes)
- 0x00000003 (PLTGOT) 0x1567c
- 0x00000002 (PLTRELSZ) 904 (bytes)
- 0x00000014 (PLTREL) REL
- 0x00000017 (JMPREL) 0x32dc
- 0x00000011 (REL) 0x2ddc
- 0x00000012 (RELSZ) 1280 (bytes)
- 0x00000013 (RELENT) 8 (bytes)
- 0x6ffffffe (VERNEED) 0x2d9c
- 0x6fffffff (VERNEEDNUM) 2
- 0x6ffffff0 (VERSYM) 0x2be6
- 0x6ffffffa (RELCOUNT) 145
- 0x00000000 (NULL) 0x0
-
-Relocation section '.rel.dyn' at offset 0x2ddc contains 160 entries:
- Offset Info Type Sym. Value Symbol's Name
-00015000 00000017 R_ARM_RELATIVE
-00015004 00000017 R_ARM_RELATIVE
-00015010 00000017 R_ARM_RELATIVE
-0001503c 00000017 R_ARM_RELATIVE
-0001504c 00000017 R_ARM_RELATIVE
-00015058 00000017 R_ARM_RELATIVE
-00015084 00000017 R_ARM_RELATIVE
-00015094 00000017 R_ARM_RELATIVE
-000150a8 00000017 R_ARM_RELATIVE
-000150b8 00000017 R_ARM_RELATIVE
-000150c4 00000017 R_ARM_RELATIVE
-000150e8 00000017 R_ARM_RELATIVE
-00015114 00000017 R_ARM_RELATIVE
-00015130 00000017 R_ARM_RELATIVE
-0001515c 00000017 R_ARM_RELATIVE
-0001516c 00000017 R_ARM_RELATIVE
-00015180 00000017 R_ARM_RELATIVE
-00015190 00000017 R_ARM_RELATIVE
-0001519c 00000017 R_ARM_RELATIVE
-000151c0 00000017 R_ARM_RELATIVE
-000151e4 00000017 R_ARM_RELATIVE
-000151e8 00000017 R_ARM_RELATIVE
-000151f0 00000017 R_ARM_RELATIVE
-000151f4 00000017 R_ARM_RELATIVE
-00015208 00000017 R_ARM_RELATIVE
-0001520c 00000017 R_ARM_RELATIVE
-00015214 00000017 R_ARM_RELATIVE
-00015218 00000017 R_ARM_RELATIVE
-0001522c 00000017 R_ARM_RELATIVE
-00015230 00000017 R_ARM_RELATIVE
-00015238 00000017 R_ARM_RELATIVE
-0001523c 00000017 R_ARM_RELATIVE
-00015244 00000017 R_ARM_RELATIVE
-00015248 00000017 R_ARM_RELATIVE
-00015250 00000017 R_ARM_RELATIVE
-00015254 00000017 R_ARM_RELATIVE
-00015268 00000017 R_ARM_RELATIVE
-0001526c 00000017 R_ARM_RELATIVE
-00015274 00000017 R_ARM_RELATIVE
-00015278 00000017 R_ARM_RELATIVE
-00015280 00000017 R_ARM_RELATIVE
-00015284 00000017 R_ARM_RELATIVE
-00015298 00000017 R_ARM_RELATIVE
-0001529c 00000017 R_ARM_RELATIVE
-000152a4 00000017 R_ARM_RELATIVE
-000152a8 00000017 R_ARM_RELATIVE
-000152b0 00000017 R_ARM_RELATIVE
-000152b4 00000017 R_ARM_RELATIVE
-000152bc 00000017 R_ARM_RELATIVE
-000152c0 00000017 R_ARM_RELATIVE
-000152c8 00000017 R_ARM_RELATIVE
-000152cc 00000017 R_ARM_RELATIVE
-000152d4 00000017 R_ARM_RELATIVE
-000152d8 00000017 R_ARM_RELATIVE
-000152e0 00000017 R_ARM_RELATIVE
-000152e4 00000017 R_ARM_RELATIVE
-000152f8 00000017 R_ARM_RELATIVE
-000152fc 00000017 R_ARM_RELATIVE
-00015304 00000017 R_ARM_RELATIVE
-00015308 00000017 R_ARM_RELATIVE
-00015310 00000017 R_ARM_RELATIVE
-00015314 00000017 R_ARM_RELATIVE
-0001531c 00000017 R_ARM_RELATIVE
-00015320 00000017 R_ARM_RELATIVE
-00015334 00000017 R_ARM_RELATIVE
-00015338 00000017 R_ARM_RELATIVE
-00015340 00000017 R_ARM_RELATIVE
-00015344 00000017 R_ARM_RELATIVE
-0001534c 00000017 R_ARM_RELATIVE
-00015350 00000017 R_ARM_RELATIVE
-00015364 00000017 R_ARM_RELATIVE
-00015368 00000017 R_ARM_RELATIVE
-00015370 00000017 R_ARM_RELATIVE
-00015374 00000017 R_ARM_RELATIVE
-0001537c 00000017 R_ARM_RELATIVE
-00015380 00000017 R_ARM_RELATIVE
-00015388 00000017 R_ARM_RELATIVE
-0001538c 00000017 R_ARM_RELATIVE
-00015394 00000017 R_ARM_RELATIVE
-00015398 00000017 R_ARM_RELATIVE
-000153a0 00000017 R_ARM_RELATIVE
-000153a4 00000017 R_ARM_RELATIVE
-000153ac 00000017 R_ARM_RELATIVE
-000153b0 00000017 R_ARM_RELATIVE
-000153b8 00000017 R_ARM_RELATIVE
-000153bc 00000017 R_ARM_RELATIVE
-000153c4 00000017 R_ARM_RELATIVE
-000153c8 00000017 R_ARM_RELATIVE
-000153d0 00000017 R_ARM_RELATIVE
-000153d4 00000017 R_ARM_RELATIVE
-000153dc 00000017 R_ARM_RELATIVE
-000153e0 00000017 R_ARM_RELATIVE
-000153e8 00000017 R_ARM_RELATIVE
-000153ec 00000017 R_ARM_RELATIVE
-000153f4 00000017 R_ARM_RELATIVE
-000153f8 00000017 R_ARM_RELATIVE
-00015400 00000017 R_ARM_RELATIVE
-00015404 00000017 R_ARM_RELATIVE
-0001540c 00000017 R_ARM_RELATIVE
-00015410 00000017 R_ARM_RELATIVE
-00015424 00000017 R_ARM_RELATIVE
-00015428 00000017 R_ARM_RELATIVE
-00015430 00000017 R_ARM_RELATIVE
-00015434 00000017 R_ARM_RELATIVE
-0001543c 00000017 R_ARM_RELATIVE
-00015440 00000017 R_ARM_RELATIVE
-00015448 00000017 R_ARM_RELATIVE
-0001544c 00000017 R_ARM_RELATIVE
-00015454 00000017 R_ARM_RELATIVE
-00015458 00000017 R_ARM_RELATIVE
-00015460 00000017 R_ARM_RELATIVE
-00015464 00000017 R_ARM_RELATIVE
-0001546c 00000017 R_ARM_RELATIVE
-00015470 00000017 R_ARM_RELATIVE
-00015478 00000017 R_ARM_RELATIVE
-0001547c 00000017 R_ARM_RELATIVE
-00015484 00000017 R_ARM_RELATIVE
-00015488 00000017 R_ARM_RELATIVE
-00015490 00000017 R_ARM_RELATIVE
-00015494 00000017 R_ARM_RELATIVE
-0001549c 00000017 R_ARM_RELATIVE
-000154a0 00000017 R_ARM_RELATIVE
-000154b4 00000017 R_ARM_RELATIVE
-000154b8 00000017 R_ARM_RELATIVE
-000154c0 00000017 R_ARM_RELATIVE
-000154c4 00000017 R_ARM_RELATIVE
-000154cc 00000017 R_ARM_RELATIVE
-000154d0 00000017 R_ARM_RELATIVE
-000154d8 00000017 R_ARM_RELATIVE
-000154dc 00000017 R_ARM_RELATIVE
-000154f0 00000017 R_ARM_RELATIVE
-000154f4 00000017 R_ARM_RELATIVE
-000154fc 00000017 R_ARM_RELATIVE
-00015500 00000017 R_ARM_RELATIVE
-00015508 00000017 R_ARM_RELATIVE
-0001550c 00000017 R_ARM_RELATIVE
-00015514 00000017 R_ARM_RELATIVE
-00015518 00000017 R_ARM_RELATIVE
-00015520 00000017 R_ARM_RELATIVE
-00015524 00000017 R_ARM_RELATIVE
-0001552c 00000017 R_ARM_RELATIVE
-00015530 00000017 R_ARM_RELATIVE
-00015538 00000017 R_ARM_RELATIVE
-0001553c 00000017 R_ARM_RELATIVE
-00015888 00000017 R_ARM_RELATIVE
-0001584c 00000215 R_ARM_GLOB_DAT 00000000 g_free
-00015850 00000915 R_ARM_GLOB_DAT 00009e60 gst_interfaces_marshal_VOID__OBJECT_ULONG
-00015854 00001315 R_ARM_GLOB_DAT 00000000 g_cclosure_marshal_VOID__INT
-00015858 00001815 R_ARM_GLOB_DAT 00000000 __gst_debug_min
-0001585c 00001915 R_ARM_GLOB_DAT 00009f90 gst_interfaces_marshal_VOID__OBJECT_POINTER
-00015860 00001c15 R_ARM_GLOB_DAT 00000000 __gmon_start__
-00015864 00001d15 R_ARM_GLOB_DAT 00000000 _Jv_RegisterClasses
-00015868 00003e15 R_ARM_GLOB_DAT 00009ef8 gst_interfaces_marshal_VOID__OBJECT_STRING
-0001586c 00005615 R_ARM_GLOB_DAT 00000000 GST_CAT_DEFAULT
-00015870 00008815 R_ARM_GLOB_DAT 00000000 g_cclosure_marshal_VOID__POINTER
-00015874 0000b215 R_ARM_GLOB_DAT 0000a028 gst_interfaces_marshal_VOID__OBJECT_BOOLEAN
-00015878 0000b415 R_ARM_GLOB_DAT 00000000 g_cclosure_marshal_VOID__OBJECT
-0001587c 0000cc15 R_ARM_GLOB_DAT 00000000 g_cclosure_marshal_VOID__ULONG
-00015880 0000d415 R_ARM_GLOB_DAT 00000000 __cxa_finalize
-00015884 0000d515 R_ARM_GLOB_DAT 00009dcc gst_interfaces_marshal_VOID__OBJECT_INT
-
-Relocation section '.rel.plt' at offset 0x32dc contains 113 entries:
- Offset Info Type Sym. Value Symbol's Name
-00015688 00000216 R_ARM_JUMP_SLOT 00000000 g_free
-0001568c 00000316 R_ARM_JUMP_SLOT 00000000 g_type_interface_peek
-00015690 00000616 R_ARM_JUMP_SLOT 00000000 g_value_unset
-00015694 00000816 R_ARM_JUMP_SLOT 00000000 g_param_spec_string
-00015698 00000a16 R_ARM_JUMP_SLOT 00000000 gst_structure_has_name
-0001569c 00000c16 R_ARM_JUMP_SLOT 00000000 gst_value_array_get_value
-000156a0 00000d16 R_ARM_JUMP_SLOT 000072c4 gst_navigation_send_event
-000156a4 00001116 R_ARM_JUMP_SLOT 00006c10 gst_navigation_query_get_type
-000156a8 00001216 R_ARM_JUMP_SLOT 00000000 g_value_dup_string
-000156ac 00001416 R_ARM_JUMP_SLOT 00000000 g_flags_register_static
-000156b0 00001516 R_ARM_JUMP_SLOT 000076ec gst_property_probe_needs_probe
-000156b4 00001716 R_ARM_JUMP_SLOT 00000000 g_object_get_data
-000156b8 00001a16 R_ARM_JUMP_SLOT 00000000 g_signal_emit
-000156bc 00001b16 R_ARM_JUMP_SLOT 000074b0 gst_property_probe_get_type
-000156c0 00001c16 R_ARM_JUMP_SLOT 00000000 __gmon_start__
-000156c4 00001e16 R_ARM_JUMP_SLOT 00000000 g_signal_emit_by_name
-000156c8 00002216 R_ARM_JUMP_SLOT 00000000 pow
-000156cc 00002416 R_ARM_JUMP_SLOT 00000000 g_value_get_enum
-000156d0 00002716 R_ARM_JUMP_SLOT 00000000 g_list_foreach
-000156d4 00002816 R_ARM_JUMP_SLOT 00000000 g_list_free
-000156d8 00002916 R_ARM_JUMP_SLOT 00000000 gst_message_new_custom
-000156dc 00002b16 R_ARM_JUMP_SLOT 00000000 g_value_set_int
-000156e0 00002d16 R_ARM_JUMP_SLOT 00000000 g_object_set_data_full
-000156e4 00003116 R_ARM_JUMP_SLOT 00007274 gst_navigation_get_type
-000156e8 00003216 R_ARM_JUMP_SLOT 00000000 gst_structure_get_int
-000156ec 00003316 R_ARM_JUMP_SLOT 00000000 g_value_get_uint
-000156f0 00003516 R_ARM_JUMP_SLOT 00000000 gst_fraction_get_type
-000156f4 00003616 R_ARM_JUMP_SLOT 00000000 g_object_class_install_property
-000156f8 00003716 R_ARM_JUMP_SLOT 00000000 gst_value_array_get_type
-000156fc 00003816 R_ARM_JUMP_SLOT 00000000 g_param_spec_uint
-00015700 00003916 R_ARM_JUMP_SLOT 00000000 g_enum_register_static
-00015704 00003a16 R_ARM_JUMP_SLOT 00000000 g_malloc
-00015708 00003d16 R_ARM_JUMP_SLOT 00009348 gst_tuner_norm_get_type
-0001570c 00003f16 R_ARM_JUMP_SLOT 00000000 g_value_peek_pointer
-00015710 00004016 R_ARM_JUMP_SLOT 00000000 gst_structure_set_value
-00015714 00004116 R_ARM_JUMP_SLOT 00000000 gst_structure_get_uint
-00015718 00004216 R_ARM_JUMP_SLOT 00000000 gst_structure_get_double
-0001571c 00004416 R_ARM_JUMP_SLOT 00000000 g_param_spec_int
-00015720 00004916 R_ARM_JUMP_SLOT 00000000 gst_structure_new
-00015724 00004e16 R_ARM_JUMP_SLOT 000040b0 gst_mixer_message_get_type
-00015728 00004f16 R_ARM_JUMP_SLOT 000098b8 gst_x_overlay_get_type
-0001572c 00005016 R_ARM_JUMP_SLOT 00009640 gst_video_orientation_get_type
-00015730 00005216 R_ARM_JUMP_SLOT 00007500 gst_property_probe_get_values
-00015734 00005716 R_ARM_JUMP_SLOT 00000000 gst_implements_interface_check
-00015738 00005816 R_ARM_JUMP_SLOT 00005560 gst_mixer_get_type
-0001573c 00005916 R_ARM_JUMP_SLOT 00000000 g_value_set_string
-00015740 00005a16 R_ARM_JUMP_SLOT 00005ca4 gst_mixer_options_get_type
-00015744 00005b16 R_ARM_JUMP_SLOT 0000a3fc gst_navigation_command_get_type
-00015748 00005e16 R_ARM_JUMP_SLOT 000069f8 gst_navigation_message_get_type
-0001574c 00005f16 R_ARM_JUMP_SLOT 00000000 gst_value_list_get_size
-00015750 00006016 R_ARM_JUMP_SLOT 00000000 cbrt
-00015754 00006116 R_ARM_JUMP_SLOT 00000000 g_type_check_class_cast
-00015758 00006716 R_ARM_JUMP_SLOT 00000000 gst_debug_log
-0001575c 00006916 R_ARM_JUMP_SLOT 00000000 g_object_set_data
-00015760 00006a16 R_ARM_JUMP_SLOT 00000000 g_once_init_enter_impl
-00015764 00006b16 R_ARM_JUMP_SLOT 00000000 g_param_spec_boolean
-00015768 00006c16 R_ARM_JUMP_SLOT 00000000 gst_value_list_get_type
-0001576c 00006e16 R_ARM_JUMP_SLOT 00008dbc gst_tuner_list_norms
-00015770 00007016 R_ARM_JUMP_SLOT 00000000 gst_message_get_type
-00015774 00007116 R_ARM_JUMP_SLOT 00000000 g_object_get
-00015778 00007216 R_ARM_JUMP_SLOT 00000000 gst_structure_get_string
-0001577c 00007316 R_ARM_JUMP_SLOT 000079d4 gst_property_probe_probe_and_get_values
-00015780 00007616 R_ARM_JUMP_SLOT 00000000 g_value_set_enum
-00015784 00007a16 R_ARM_JUMP_SLOT 00000000 g_return_if_fail_warning
-00015788 00007d16 R_ARM_JUMP_SLOT 00000000 g_type_register_static
-0001578c 00007f16 R_ARM_JUMP_SLOT 00000000 gst_event_get_structure
-00015790 00008016 R_ARM_JUMP_SLOT 00000000 g_object_set
-00015794 00008316 R_ARM_JUMP_SLOT 00000000 g_value_get_object
-00015798 00008916 R_ARM_JUMP_SLOT 00000000 g_signal_new
-0001579c 00008a16 R_ARM_JUMP_SLOT 00003cf4 gst_color_balance_get_type
-000157a0 00008b16 R_ARM_JUMP_SLOT 00000000 g_type_check_instance_is_a
-000157a4 00008d16 R_ARM_JUMP_SLOT 00000000 gst_message_new_element
-000157a8 00008e16 R_ARM_JUMP_SLOT 00000000 gst_structure_get_value
-000157ac 00008f16 R_ARM_JUMP_SLOT 00005e5c gst_mixer_track_get_type
-000157b0 00009016 R_ARM_JUMP_SLOT 00000000 gst_query_new_application
-000157b4 00009116 R_ARM_JUMP_SLOT 00000000 g_param_spec_double
-000157b8 00009416 R_ARM_JUMP_SLOT 00000000 gst_value_array_get_size
-000157bc 00009516 R_ARM_JUMP_SLOT 00000000 gst_message_get_structure
-000157c0 00009616 R_ARM_JUMP_SLOT 00000000 g_type_name
-000157c4 00009716 R_ARM_JUMP_SLOT 00000000 log10
-000157c8 00009916 R_ARM_JUMP_SLOT 00009480 gst_tuner_channel_get_type
-000157cc 00009b16 R_ARM_JUMP_SLOT 00000000 gst_value_list_get_value
-000157d0 00009c16 R_ARM_JUMP_SLOT 00000000 g_type_interface_add_prerequisite
-000157d4 00009d16 R_ARM_JUMP_SLOT 00000000 gst_element_post_message
-000157d8 00009e16 R_ARM_JUMP_SLOT 00000000 gst_implements_interface_get_type
-000157dc 00009f16 R_ARM_JUMP_SLOT 00008538 gst_tuner_get_type
-000157e0 0000a116 R_ARM_JUMP_SLOT 00000000 g_type_check_instance_cast
-000157e4 0000a216 R_ARM_JUMP_SLOT 00000000 gst_element_get_type
-000157e8 0000a316 R_ARM_JUMP_SLOT 00007f94 gst_stream_volume_convert_volume
-000157ec 0000a416 R_ARM_JUMP_SLOT 00008260 gst_stream_volume_get_type
-000157f0 0000a516 R_ARM_JUMP_SLOT 00000000 g_object_interface_install_property
-000157f4 0000a916 R_ARM_JUMP_SLOT 00000000 g_object_class_find_property
-000157f8 0000aa16 R_ARM_JUMP_SLOT 00000000 gst_value_list_append_value
-000157fc 0000af16 R_ARM_JUMP_SLOT 00007cbc gst_property_probe_get_properties
-00015800 0000b016 R_ARM_JUMP_SLOT 00000000 g_value_init
-00015804 0000b516 R_ARM_JUMP_SLOT 00000000 gst_structure_get_boolean
-00015808 0000b616 R_ARM_JUMP_SLOT 0000902c gst_tuner_list_channels
-0001580c 0000b816 R_ARM_JUMP_SLOT 00000000 g_value_set_uint
-00015810 0000b916 R_ARM_JUMP_SLOT 00000000 gst_query_get_structure
-00015814 0000be16 R_ARM_JUMP_SLOT 00000000 g_type_check_value_holds
-00015818 0000c016 R_ARM_JUMP_SLOT 00000000 g_value_get_int
-0001581c 0000c216 R_ARM_JUMP_SLOT 00000000 g_once_init_leave
-00015820 0000c416 R_ARM_JUMP_SLOT 00000000 gst_value_array_append_value
-00015824 0000c516 R_ARM_JUMP_SLOT 000078e8 gst_property_probe_probe_property
-00015828 0000c616 R_ARM_JUMP_SLOT 00000000 gst_object_get_type
-0001582c 0000cd16 R_ARM_JUMP_SLOT 00000000 g_type_class_peek_parent
-00015830 0000ce16 R_ARM_JUMP_SLOT 0000642c gst_navigation_event_get_type
-00015834 0000cf16 R_ARM_JUMP_SLOT 00000000 g_log
-00015838 0000d116 R_ARM_JUMP_SLOT 00000000 strcmp
-0001583c 0000d216 R_ARM_JUMP_SLOT 00000000 g_str_equal
-00015840 0000d416 R_ARM_JUMP_SLOT 00000000 __cxa_finalize
-00015844 0000d716 R_ARM_JUMP_SLOT 00000000 gst_structure_set
-00015848 0000d816 R_ARM_JUMP_SLOT 00003f08 gst_color_balance_channel_get_type
-
-There are no unwind sections in this file.
-
-Symbol table '.dynsym' contains 218 entries:
- Num: Value Size Type Bind Vis Ndx Name
- 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 00003664 0 SECTION LOCAL DEFAULT 8
- 2: 00000000 88 FUNC GLOBAL DEFAULT UND g_free
- 3: 00000000 424 FUNC GLOBAL DEFAULT UND g_type_interface_peek
- 4: 00006560 168 FUNC GLOBAL DEFAULT 10 gst_navigation_event_parse_command
- 5: 00009bb4 368 FUNC GLOBAL DEFAULT 10 gst_x_overlay_got_xwindow_id
- 6: 00000000 148 FUNC GLOBAL DEFAULT UND g_value_unset
- 7: 00009924 160 FUNC GLOBAL DEFAULT 10 gst_x_overlay_handle_events
- 8: 00000000 116 FUNC GLOBAL DEFAULT UND g_param_spec_string
- 9: 00009e60 152 FUNC GLOBAL DEFAULT 10 gst_interfaces_marshal_VOID__OBJECT_ULONG
- 10: 00000000 172 FUNC GLOBAL DEFAULT UND gst_structure_has_name
- 11: 00004304 340 FUNC GLOBAL DEFAULT 10 gst_mixer_message_parse_option_changed
- 12: 00000000 204 FUNC GLOBAL DEFAULT UND gst_value_array_get_value
- 13: 000072c4 60 FUNC GLOBAL DEFAULT 10 gst_navigation_send_event
- 14: 00004814 376 FUNC GLOBAL DEFAULT 10 gst_mixer_message_parse_mute_toggled
- 15: 00008ba4 272 FUNC GLOBAL DEFAULT 10 gst_tuner_set_frequency
- 16: 000097ac 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_get_vcenter
- 17: 00006c10 172 FUNC GLOBAL DEFAULT 10 gst_navigation_query_get_type
- 18: 00000000 116 FUNC GLOBAL DEFAULT UND g_value_dup_string
- 19: 00000000 176 FUNC GLOBAL DEFAULT UND g_cclosure_marshal_VOID__INT
- 20: 00000000 220 FUNC GLOBAL DEFAULT UND g_flags_register_static
- 21: 000076ec 252 FUNC GLOBAL DEFAULT 10 gst_property_probe_needs_probe
- 22: 00008d38 132 FUNC GLOBAL DEFAULT 10 gst_tuner_set_norm
- 23: 00000000 188 FUNC GLOBAL DEFAULT UND g_object_get_data
- 24: 00000000 4 OBJECT GLOBAL DEFAULT UND __gst_debug_min
- 25: 00009f90 152 FUNC GLOBAL DEFAULT 10 gst_interfaces_marshal_VOID__OBJECT_POINTER
- 26: 00000000 48 FUNC GLOBAL DEFAULT UND g_signal_emit
- 27: 000074b0 80 FUNC GLOBAL DEFAULT 10 gst_property_probe_get_type
- 28: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
- 29: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
- 30: 00000000 496 FUNC GLOBAL DEFAULT UND g_signal_emit_by_name
- 31: 000057a8 68 FUNC GLOBAL DEFAULT 10 gst_mixer_set_record
- 32: 0000a4ec 120 FUNC GLOBAL DEFAULT 10 gst_mixer_flags_get_type
- 33: 0000a1a4 120 FUNC GLOBAL DEFAULT 10 gst_tuner_channel_flags_get_type
- 34: 00000000 728 FUNC GLOBAL DEFAULT UND pow@GLIBC_2.4 (2)
- 35: 00009a64 336 FUNC GLOBAL DEFAULT 10 gst_x_overlay_prepare_xwindow_id
- 36: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_get_enum
- 37: 00005a5c 112 FUNC GLOBAL DEFAULT 10 gst_mixer_list_tracks
- 38: 00007d7c 384 FUNC GLOBAL DEFAULT 10 gst_property_probe_get_property
- 39: 00000000 52 FUNC GLOBAL DEFAULT UND g_list_foreach
- 40: 00000000 16 FUNC GLOBAL DEFAULT UND g_list_free
- 41: 00000000 276 FUNC GLOBAL DEFAULT UND gst_message_new_custom
- 42: 000096ac 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_set_vcenter
- 43: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_set_int
- 44: 000041dc 296 FUNC GLOBAL DEFAULT 10 gst_mixer_message_parse_options_list_changed
- 45: 00000000 196 FUNC GLOBAL DEFAULT UND g_object_set_data_full
- 46: 000066e8 268 FUNC GLOBAL DEFAULT 10 gst_navigation_event_parse_mouse_button_event
- 47: 00004b04 540 FUNC GLOBAL DEFAULT 10 gst_mixer_options_list_changed
- 48: 00005890 252 FUNC GLOBAL DEFAULT 10 gst_mixer_get_volume
- 49: 00007274 80 FUNC GLOBAL DEFAULT 10 gst_navigation_get_type
- 50: 00000000 272 FUNC GLOBAL DEFAULT UND gst_structure_get_int
- 51: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_get_uint
- 52: 0000563c 32 FUNC GLOBAL DEFAULT 10 gst_mixer_get_mixer_type
- 53: 00000000 120 FUNC GLOBAL DEFAULT UND gst_fraction_get_type
- 54: 00000000 564 FUNC GLOBAL DEFAULT UND g_object_class_install_property
- 55: 00000000 124 FUNC GLOBAL DEFAULT UND gst_value_array_get_type
- 56: 00000000 184 FUNC GLOBAL DEFAULT UND g_param_spec_uint
- 57: 00000000 220 FUNC GLOBAL DEFAULT UND g_enum_register_static
- 58: 00000000 160 FUNC GLOBAL DEFAULT UND g_malloc
- 59: 00006d9c 156 FUNC GLOBAL DEFAULT 10 gst_navigation_query_set_angles
- 60: 00003c8c 104 FUNC GLOBAL DEFAULT 10 gst_color_balance_value_changed
- 61: 00009348 80 FUNC GLOBAL DEFAULT 10 gst_tuner_norm_get_type
- 62: 00009ef8 152 FUNC GLOBAL DEFAULT 10 gst_interfaces_marshal_VOID__OBJECT_STRING
- 63: 00000000 180 FUNC GLOBAL DEFAULT UND g_value_peek_pointer
- 64: 00000000 232 FUNC GLOBAL DEFAULT UND gst_structure_set_value
- 65: 00000000 272 FUNC GLOBAL DEFAULT UND gst_structure_get_uint
- 66: 00000000 272 FUNC GLOBAL DEFAULT UND gst_structure_get_double
- 67: 000057ec 164 FUNC GLOBAL DEFAULT 10 gst_mixer_set_mute
- 68: 00000000 184 FUNC GLOBAL DEFAULT UND g_param_spec_int
- 69: 0000a564 120 FUNC GLOBAL DEFAULT 10 gst_mixer_message_type_get_type
- 70: 000067f4 136 FUNC GLOBAL DEFAULT 10 gst_navigation_event_parse_key_event
- 71: 0000972c 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_set_vflip
- 72: 00008a88 284 FUNC GLOBAL DEFAULT 10 gst_tuner_get_frequency
- 73: 00000000 124 FUNC GLOBAL DEFAULT UND gst_structure_new
- 74: 00006e38 92 FUNC GLOBAL DEFAULT 10 gst_navigation_query_new_angles
- 75: 0000986c 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_get_hflip
- 76: 00008894 216 FUNC GLOBAL DEFAULT 10 gst_tuner_channel_changed
- 77: 0000896c 284 FUNC GLOBAL DEFAULT 10 gst_tuner_signal_strength
- 78: 000040b0 300 FUNC GLOBAL DEFAULT 10 gst_mixer_message_get_type
- 79: 000098b8 108 FUNC GLOBAL DEFAULT 10 gst_x_overlay_get_type
- 80: 00009640 108 FUNC GLOBAL DEFAULT 10 gst_video_orientation_get_type
- 81: 00008354 128 FUNC GLOBAL DEFAULT 10 gst_stream_volume_get_mute
- 82: 00007500 240 FUNC GLOBAL DEFAULT 10 gst_property_probe_get_values
- 83: 000097ec 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_get_hcenter
- 84: 0000737c 192 FUNC GLOBAL DEFAULT 10 gst_navigation_send_mouse_event
- 85: 00006ef0 152 FUNC GLOBAL DEFAULT 10 gst_navigation_query_parse_commands_length
- 86: 00000000 4 OBJECT GLOBAL DEFAULT UND GST_CAT_DEFAULT
- 87: 00000000 164 FUNC GLOBAL DEFAULT UND gst_implements_interface_check
- 88: 00005560 108 FUNC GLOBAL DEFAULT 10 gst_mixer_get_type
- 89: 00000000 160 FUNC GLOBAL DEFAULT UND g_value_set_string
- 90: 00005ca4 88 FUNC GLOBAL DEFAULT 10 gst_mixer_options_get_type
- 91: 0000a3fc 120 FUNC GLOBAL DEFAULT 10 gst_navigation_command_get_type
- 92: 00003d5c 32 FUNC GLOBAL DEFAULT 10 gst_color_balance_get_balance_type
- 93: 0000a21c 120 FUNC GLOBAL DEFAULT 10 gst_stream_volume_format_get_type
- 94: 000069f8 224 FUNC GLOBAL DEFAULT 10 gst_navigation_message_get_type
- 95: 00000000 128 FUNC GLOBAL DEFAULT UND gst_value_list_get_size
- 96: 00000000 656 FUNC GLOBAL DEFAULT UND cbrt@GLIBC_2.4 (2)
- 97: 00000000 360 FUNC GLOBAL DEFAULT UND g_type_check_class_cast
- 98: 00003d7c 68 FUNC GLOBAL DEFAULT 10 gst_color_balance_get_value
- 99: 00007300 124 FUNC GLOBAL DEFAULT 10 gst_navigation_send_command
- 100: 000052ec 628 FUNC GLOBAL DEFAULT 10 gst_mixer_volume_changed
- 101: 000087bc 216 FUNC GLOBAL DEFAULT 10 gst_tuner_norm_changed
- 102: 000085a4 264 FUNC GLOBAL DEFAULT 10 gst_tuner_signal_changed
- 103: 00000000 56 FUNC GLOBAL DEFAULT UND gst_debug_log
- 104: 000050fc 496 FUNC GLOBAL DEFAULT 10 gst_mixer_mute_toggled
- 105: 00000000 184 FUNC GLOBAL DEFAULT UND g_object_set_data
- 106: 00000000 272 FUNC GLOBAL DEFAULT UND g_once_init_enter_impl
- 107: 00000000 148 FUNC GLOBAL DEFAULT UND g_param_spec_boolean
- 108: 00000000 124 FUNC GLOBAL DEFAULT UND gst_value_list_get_type
- 109: 000077e8 256 FUNC GLOBAL DEFAULT 10 gst_property_probe_needs_probe_name
- 110: 00008dbc 132 FUNC GLOBAL DEFAULT 10 gst_tuner_list_norms
- 111: 00003e04 56 FUNC GLOBAL DEFAULT 10 gst_color_balance_list_channels
- 112: 00000000 220 FUNC GLOBAL DEFAULT UND gst_message_get_type
- 113: 00000000 164 FUNC GLOBAL DEFAULT UND g_object_get
- 114: 00000000 168 FUNC GLOBAL DEFAULT UND gst_structure_get_string
- 115: 000079d4 244 FUNC GLOBAL DEFAULT 10 gst_property_probe_probe_and_get_values
- 116: 00004458 580 FUNC GLOBAL DEFAULT 10 gst_mixer_message_parse_volume_changed
- 117: 00006bb8 88 FUNC GLOBAL DEFAULT 10 gst_navigation_message_parse_mouse_over
- 118: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_set_enum
- 119: 00008f24 132 FUNC GLOBAL DEFAULT 10 gst_tuner_get_channel
- 120: 0000743c 116 FUNC GLOBAL DEFAULT 10 gst_navigation_send_key_event
- 121: 00006608 224 FUNC GLOBAL DEFAULT 10 gst_navigation_event_parse_mouse_move_event
- 122: 00000000 100 FUNC GLOBAL DEFAULT UND g_return_if_fail_warning
- 123: 000096ec 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_set_hcenter
- 124: 00006f88 200 FUNC GLOBAL DEFAULT 10 gst_navigation_query_parse_commands_nth
- 125: 00000000 1288 FUNC GLOBAL DEFAULT UND g_type_register_static
- 126: 0000a474 120 FUNC GLOBAL DEFAULT 10 gst_mixer_track_flags_get_type
- 127: 00000000 136 FUNC GLOBAL DEFAULT UND gst_event_get_structure
- 128: 00000000 168 FUNC GLOBAL DEFAULT UND g_object_set
- 129: 000099c4 160 FUNC GLOBAL DEFAULT 10 gst_x_overlay_expose
- 130: 00008fa8 132 FUNC GLOBAL DEFAULT 10 gst_tuner_set_channel
- 131: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_get_object
- 132: 0000565c 168 FUNC GLOBAL DEFAULT 10 gst_mixer_get_option
- 133: 00003dc0 68 FUNC GLOBAL DEFAULT 10 gst_color_balance_set_value
- 134: 00006cbc 224 FUNC GLOBAL DEFAULT 10 gst_navigation_query_parse_angles
- 135: 0000687c 152 FUNC GLOBAL DEFAULT 10 gst_navigation_message_new_angles_changed
- 136: 00000000 176 FUNC GLOBAL DEFAULT UND g_cclosure_marshal_VOID__POINTER
- 137: 00000000 544 FUNC GLOBAL DEFAULT UND g_signal_new
- 138: 00003cf4 104 FUNC GLOBAL DEFAULT 10 gst_color_balance_get_type
- 139: 00000000 452 FUNC GLOBAL DEFAULT UND g_type_check_instance_is_a
- 140: 0000469c 376 FUNC GLOBAL DEFAULT 10 gst_mixer_message_parse_record_toggled
- 141: 00000000 16 FUNC GLOBAL DEFAULT UND gst_message_new_element
- 142: 00000000 148 FUNC GLOBAL DEFAULT UND gst_structure_get_value
- 143: 00005e5c 80 FUNC GLOBAL DEFAULT 10 gst_mixer_track_get_type
- 144: 00000000 132 FUNC GLOBAL DEFAULT UND gst_query_new_application
- 145: 00000000 236 FUNC GLOBAL DEFAULT UND g_param_spec_double
- 146: 00006e94 92 FUNC GLOBAL DEFAULT 10 gst_navigation_query_new_commands
- 147: 00005704 164 FUNC GLOBAL DEFAULT 10 gst_mixer_set_option
- 148: 00000000 128 FUNC GLOBAL DEFAULT UND gst_value_array_get_size
- 149: 00000000 136 FUNC GLOBAL DEFAULT UND gst_message_get_structure
- 150: 00000000 156 FUNC GLOBAL DEFAULT UND g_type_name
- 151: 00000000 236 FUNC GLOBAL DEFAULT UND log10@GLIBC_2.4 (2)
- 152: 00007188 236 FUNC GLOBAL DEFAULT 10 gst_navigation_query_set_commands
- 153: 00009480 80 FUNC GLOBAL DEFAULT 10 gst_tuner_channel_get_type
- 154: 00007bc4 248 FUNC GLOBAL DEFAULT 10 gst_property_probe_probe_property_name
- 155: 00000000 204 FUNC GLOBAL DEFAULT UND gst_value_list_get_value
- 156: 00000000 984 FUNC GLOBAL DEFAULT UND g_type_interface_add_prerequisite
- 157: 00000000 492 FUNC GLOBAL DEFAULT UND gst_element_post_message
- 158: 00000000 136 FUNC GLOBAL DEFAULT UND gst_implements_interface_get_type
- 159: 00008538 108 FUNC GLOBAL DEFAULT 10 gst_tuner_get_type
- 160: 00005cfc 144 FUNC GLOBAL DEFAULT 10 gst_mixer_options_get_values
- 161: 00000000 616 FUNC GLOBAL DEFAULT UND g_type_check_instance_cast
- 162: 00000000 160 FUNC GLOBAL DEFAULT UND gst_element_get_type
- 163: 00007f94 512 FUNC GLOBAL DEFAULT 10 gst_stream_volume_convert_volume
- 164: 00008260 128 FUNC GLOBAL DEFAULT 10 gst_stream_volume_get_type
- 165: 00000000 316 FUNC GLOBAL DEFAULT UND g_object_interface_install_property
- 166: 000083d4 184 FUNC GLOBAL DEFAULT 10 gst_stream_volume_set_volume
- 167: 0000598c 208 FUNC GLOBAL DEFAULT 10 gst_mixer_set_volume
- 168: 00008cb4 132 FUNC GLOBAL DEFAULT 10 gst_tuner_get_norm
- 169: 00000000 220 FUNC GLOBAL DEFAULT UND g_object_class_find_property
- 170: 00000000 192 FUNC GLOBAL DEFAULT UND gst_value_list_append_value
- 171: 00008e40 228 FUNC GLOBAL DEFAULT 10 gst_tuner_find_norm_by_name
- 172: 000082e0 116 FUNC GLOBAL DEFAULT 10 gst_stream_volume_set_mute
- 173: 0000a0c0 108 FUNC GLOBAL DEFAULT 10 gst_mixer_type_get_type
- 174: 00007ac8 252 FUNC GLOBAL DEFAULT 10 gst_property_probe_probe_and_get_values_name
- 175: 00007cbc 192 FUNC GLOBAL DEFAULT 10 gst_property_probe_get_properties
- 176: 00000000 348 FUNC GLOBAL DEFAULT UND g_value_init
- 177: 0000982c 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_get_vflip
- 178: 0000a028 152 FUNC GLOBAL DEFAULT 10 gst_interfaces_marshal_VOID__OBJECT_BOOLEAN
- 179: 00004f0c 496 FUNC GLOBAL DEFAULT 10 gst_mixer_record_toggled
- 180: 00000000 176 FUNC GLOBAL DEFAULT UND g_cclosure_marshal_VOID__OBJECT
- 181: 00000000 220 FUNC GLOBAL DEFAULT UND gst_structure_get_boolean
- 182: 0000902c 132 FUNC GLOBAL DEFAULT 10 gst_tuner_list_channels
- 183: 00006914 100 FUNC GLOBAL DEFAULT 10 gst_navigation_message_new_commands_changed
- 184: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_set_uint
- 185: 00000000 136 FUNC GLOBAL DEFAULT UND gst_query_get_structure
- 186: 0000976c 64 FUNC GLOBAL DEFAULT 10 gst_video_orientation_set_hflip
- 187: 000086ac 272 FUNC GLOBAL DEFAULT 10 gst_tuner_frequency_changed
- 188: 0000a294 120 FUNC GLOBAL DEFAULT 10 gst_navigation_event_type_get_type
- 189: 00006ad8 224 FUNC GLOBAL DEFAULT 10 gst_navigation_message_parse_angles_changed
- 190: 00000000 504 FUNC GLOBAL DEFAULT UND g_type_check_value_holds
- 191: 000075f0 252 FUNC GLOBAL DEFAULT 10 gst_property_probe_get_values_name
- 192: 00000000 112 FUNC GLOBAL DEFAULT UND g_value_get_int
- 193: 0000a30c 120 FUNC GLOBAL DEFAULT 10 gst_navigation_message_type_get_type
- 194: 00000000 284 FUNC GLOBAL DEFAULT UND g_once_init_leave
- 195: 0000a384 120 FUNC GLOBAL DEFAULT 10 gst_navigation_query_type_get_type
- 196: 00000000 192 FUNC GLOBAL DEFAULT UND gst_value_array_append_value
- 197: 000078e8 236 FUNC GLOBAL DEFAULT 10 gst_property_probe_probe_property
- 198: 00000000 172 FUNC GLOBAL DEFAULT UND gst_object_get_type
- 199: 000070b8 208 FUNC GLOBAL DEFAULT 10 gst_navigation_query_set_commandsv
- 200: 00004d20 492 FUNC GLOBAL DEFAULT 10 gst_mixer_option_changed
- 201: 000055cc 112 FUNC GLOBAL DEFAULT 10 gst_mixer_get_mixer_flags
- 202: 0000848c 172 FUNC GLOBAL DEFAULT 10 gst_stream_volume_get_volume
- 203: 0000a12c 120 FUNC GLOBAL DEFAULT 10 gst_color_balance_type_get_type
- 204: 00000000 176 FUNC GLOBAL DEFAULT UND g_cclosure_marshal_VOID__ULONG
- 205: 00000000 260 FUNC GLOBAL DEFAULT UND g_type_class_peek_parent
- 206: 0000642c 308 FUNC GLOBAL DEFAULT 10 gst_navigation_event_get_type
- 207: 00000000 48 FUNC GLOBAL DEFAULT UND g_log
- 208: 000090b0 228 FUNC GLOBAL DEFAULT 10 gst_tuner_find_channel_by_name
- 209: 00000000 52 FUNC GLOBAL DEFAULT UND strcmp@GLIBC_2.4 (3)
- 210: 00000000 20 FUNC GLOBAL DEFAULT UND g_str_equal
- 211: 00009d24 168 FUNC GLOBAL DEFAULT 10 gst_x_overlay_set_xwindow_id
- 212: 00000000 332 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.4 (3)
- 213: 00009dcc 148 FUNC GLOBAL DEFAULT 10 gst_interfaces_marshal_VOID__OBJECT_INT
- 214: 0000498c 376 FUNC GLOBAL DEFAULT 10 gst_mixer_mixer_changed
- 215: 00000000 116 FUNC GLOBAL DEFAULT UND gst_structure_set
- 216: 00003f08 80 FUNC GLOBAL DEFAULT 10 gst_color_balance_channel_get_type
- 217: 00006978 128 FUNC GLOBAL DEFAULT 10 gst_navigation_message_new_mouse_over
-
-Histogram for bucket list length (total of 197 buckets):
- Length Number % of total Coverage
- 0 71 ( 36.0%)
- 1 69 ( 35.0%) 31.9%
- 2 37 ( 18.8%) 66.2%
- 3 12 ( 6.1%) 82.9%
- 4 4 ( 2.0%) 90.3%
- 5 3 ( 1.5%) 97.2%
- 6 1 ( 0.5%) 100.0%
-
-Version symbols section '.gnu.version' contains 218 entries:
- Addr: 0000000000002be6 Offset: 0x002be6 Link: 2 (.dynsym)
- 000: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*)
- 004: 1 (*global*) 1 (*global*) 0 (*local*) 1 (*global*)
- 008: 0 (*local*) 1 (*global*) 0 (*local*) 1 (*global*)
- 00c: 0 (*local*) 1 (*global*) 1 (*global*) 1 (*global*)
- 010: 1 (*global*) 1 (*global*) 0 (*local*) 0 (*local*)
- 014: 0 (*local*) 1 (*global*) 1 (*global*) 0 (*local*)
- 018: 0 (*local*) 1 (*global*) 0 (*local*) 1 (*global*)
- 01c: 0 (*local*) 0 (*local*) 0 (*local*) 1 (*global*)
- 020: 1 (*global*) 1 (*global*) 2 (GLIBC_2.4) 1 (*global*)
- 024: 0 (*local*) 1 (*global*) 1 (*global*) 0 (*local*)
- 028: 0 (*local*) 0 (*local*) 1 (*global*) 0 (*local*)
- 02c: 1 (*global*) 0 (*local*) 1 (*global*) 1 (*global*)
- 030: 1 (*global*) 1 (*global*) 0 (*local*) 0 (*local*)
- 034: 1 (*global*) 0 (*local*) 0 (*local*) 0 (*local*)
- 038: 0 (*local*) 0 (*local*) 0 (*local*) 1 (*global*)
- 03c: 1 (*global*) 1 (*global*) 1 (*global*) 0 (*local*)
- 040: 0 (*local*) 0 (*local*) 0 (*local*) 1 (*global*)
- 044: 0 (*local*) 1 (*global*) 1 (*global*) 1 (*global*)
- 048: 1 (*global*) 0 (*local*) 1 (*global*) 1 (*global*)
- 04c: 1 (*global*) 1 (*global*) 1 (*global*) 1 (*global*)
- 050: 1 (*global*) 1 (*global*) 1 (*global*) 1 (*global*)
- 054: 1 (*global*) 1 (*global*) 0 (*local*) 0 (*local*)
- 058: 1 (*global*) 0 (*local*) 1 (*global*) 1 (*global*)
- 05c: 1 (*global*) 1 (*global*) 1 (*global*) 0 (*local*)
- 060: 2 (GLIBC_2.4) 0 (*local*) 1 (*global*) 1 (*global*)
- 064: 1 (*global*) 1 (*global*) 1 (*global*) 0 (*local*)
- 068: 1 (*global*) 0 (*local*) 0 (*local*) 0 (*local*)
- 06c: 0 (*local*) 1 (*global*) 1 (*global*) 1 (*global*)
- 070: 0 (*local*) 0 (*local*) 0 (*local*) 1 (*global*)
- 074: 1 (*global*) 1 (*global*) 0 (*local*) 1 (*global*)
- 078: 1 (*global*) 1 (*global*) 0 (*local*) 1 (*global*)
- 07c: 1 (*global*) 0 (*local*) 1 (*global*) 0 (*local*)
- 080: 0 (*local*) 1 (*global*) 1 (*global*) 0 (*local*)
- 084: 1 (*global*) 1 (*global*) 1 (*global*) 1 (*global*)
- 088: 0 (*local*) 0 (*local*) 1 (*global*) 0 (*local*)
- 08c: 1 (*global*) 0 (*local*) 0 (*local*) 1 (*global*)
- 090: 0 (*local*) 0 (*local*) 1 (*global*) 1 (*global*)
- 094: 0 (*local*) 0 (*local*) 0 (*local*) 2 (GLIBC_2.4)
- 098: 1 (*global*) 1 (*global*) 1 (*global*) 0 (*local*)
- 09c: 0 (*local*) 0 (*local*) 0 (*local*) 1 (*global*)
- 0a0: 1 (*global*) 0 (*local*) 0 (*local*) 1 (*global*)
- 0a4: 1 (*global*) 0 (*local*) 1 (*global*) 1 (*global*)
- 0a8: 1 (*global*) 0 (*local*) 0 (*local*) 1 (*global*)
- 0ac: 1 (*global*) 1 (*global*) 1 (*global*) 1 (*global*)
- 0b0: 0 (*local*) 1 (*global*) 1 (*global*) 1 (*global*)
- 0b4: 0 (*local*) 0 (*local*) 1 (*global*) 1 (*global*)
- 0b8: 0 (*local*) 0 (*local*) 1 (*global*) 1 (*global*)
- 0bc: 1 (*global*) 1 (*global*) 0 (*local*) 1 (*global*)
- 0c0: 0 (*local*) 1 (*global*) 0 (*local*) 1 (*global*)
- 0c4: 0 (*local*) 1 (*global*) 0 (*local*) 1 (*global*)
- 0c8: 1 (*global*) 1 (*global*) 1 (*global*) 1 (*global*)
- 0cc: 0 (*local*) 0 (*local*) 1 (*global*) 0 (*local*)
- 0d0: 1 (*global*) 3 (GLIBC_2.4) 0 (*local*) 1 (*global*)
- 0d4: 3 (GLIBC_2.4) 1 (*global*) 1 (*global*) 0 (*local*)
- 0d8: 1 (*global*) 1 (*global*)
-
-Version needs section '.gnu.version_r' contains 2 entries:
- Addr: 0x0000000000002d9c Offset: 0x002d9c Link to section: 3 (.dynstr)
- 000000: Version: 1 File: libc.so.6 Cnt: 1
- 0x0010: Name: GLIBC_2.4 Flags: none Version: 3
- 0x0020: Version: 1 File: libm.so.6 Cnt: 1
- 0x0030: Name: GLIBC_2.4 Flags: none Version: 2
-Attribute Section: aeabi
-File Attributes
- Tag_CPU_name: "ARM10TDMI"
- Tag_CPU_arch: v5TE
- Tag_ARM_ISA_use: Yes
- Tag_THUMB_ISA_use: Thumb-1
- Tag_ABI_PCS_wchar_t: 4
- Tag_ABI_FP_denormal: Needed
- Tag_ABI_FP_exceptions: Needed
- Tag_ABI_FP_number_model: IEEE 754
- Tag_ABI_align8_needed: Yes
- Tag_ABI_align8_preserved: Yes, except leaf SP
- Tag_ABI_enum_size: int
- Tag_ABI_optimization_goals: Aggressive Speed
$(GLIB_CFLAGS)\
$(GST_CFLAGS)\
$(MM_COMMON_CFLAGS)\
- $(MMTA_CFLAGS)\
$(MM_SOUND_CFLAGS)
#mm_camcorder_testsuite_CFLAGS += -DAPPSRC_TEST
############################################
-mm_camcorder_testsuite_DEPENDENCIES = $(top_builddir)/src/libmmfcamcorder.la
-
+mm_camcorder_testsuite_DEPENDENCIES = $(top_builddir)/src/libmmfcamcorder.la
+
mm_camcorder_testsuite_LDADD = $(top_builddir)/src/libmmfcamcorder.la \
$(GLIB_LIBS)\
$(GST_LIBS)\
$(MM_COMMON_LIBS)\
- $(MMTA_LIBS)\
$(MM_SOUND_LIBS)
10/10/07 wh01.cho@samsung.com Created
12/30/08 jh1979.park@samsung.com Modified
08/31/11 sc11.lee@samsung.com Modified (Reorganized for easy look)
+10/23/14 p.gamov@samsung.com Upgraded to Gstreamer 1.0
*/
#include "../src/include/mm_camcorder_internal.h"
#include "../src/include/mm_camcorder_util.h"
#include <gst/video/colorbalance.h>
-#include <mm_ta.h>
/*-----------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS: |
#define SRC_H_480 480
//QVGA
-#define SRC_W_320 320 // video input width
+#define SRC_W_320 320 // video input width
#define SRC_H_240 240 // video input height
//QCIF
-#define SRC_W_176 176 // video input width
+#define SRC_W_176 176 // video input width
#define SRC_H_144 144 // video input height
//QQVGA
-#define SRC_W_160 160 // video input width
+#define SRC_W_160 160 // video input width
#define SRC_H_120 120 // video input heith
//special resolution
-#define SRC_W_400 400 // video input width
+#define SRC_W_400 400 // video input width
#define SRC_H_300 300 // video input height
-#define SRC_W_192 192 // video input width
+#define SRC_W_192 192 // video input width
#define SRC_H_256 256 // video input height
-#define SRC_W_144 144 // video input width
+#define SRC_W_144 144 // video input width
#define SRC_H_176 176 // video input height
#define SRC_W_300 300
#define SRC_W_400 400
-#define DISPLAY_X_0 0 //for direct FB
-#define DISPLAY_Y_0 0 //for direct FB
+#define DISPLAY_X_0 0 //for direct FB
+#define DISPLAY_Y_0 0 //for direct FB
-#define DISPLAY_W_320 320 //for direct FB
-#define DISPLAY_H_240 240 //for direct FB
+#define DISPLAY_W_320 320 //for direct FB
+#define DISPLAY_H_240 240 //for direct FB
#define SRC_VIDEO_FRAME_RATE_15 15 // video input frame rate
#define SRC_VIDEO_FRAME_RATE_30 30 // video input frame rate
-#define IMAGE_ENC_QUALITY 85 // quality of jpeg
+#define IMAGE_ENC_QUALITY 85 // quality of jpeg
#define IMAGE_CAPTURE_COUNT_STILL 1 // the number of still-shot
#define IMAGE_CAPTURE_COUNT_MULTI 3 // default the number of multi-shot
#define IMAGE_CAPTURE_COUNT_INTERVAL 100 // mili seconds
#define EXT_AMR "amr"
#define EXT_MKV "mkv"
-#define STILL_CAPTURE_FILE_PATH_NAME "/opt/media/StillshotCapture"
-#define MULTI_CAPTURE_FILE_PATH_NAME "/opt/media/MultishotCapture"
-#define IMAGE_CAPTURE_THUMBNAIL_PATH "/opt/media/thumbnail.jpg"
-#define IMAGE_CAPTURE_SCREENNAIL_PATH "/opt/media/screennail.yuv"
-#define IMAGE_CAPTURE_EXIF_PATH "/opt/media/exif.raw"
-#define TARGET_FILENAME_PATH "/opt/media/"
-#define TARGET_FILENAME_VIDEO "/opt/media/test_rec_video.3gp"
-#define TARGET_FILENAME_AUDIO "/opt/media/test_rec_audio.amr"
+#define TARGET_FILENAME_PATH "/opt/usr/media/"
+#define STILL_CAPTURE_FILE_PATH_NAME TARGET_FILENAME_PATH"StillshotCapture"
+#define MULTI_CAPTURE_FILE_PATH_NAME TARGET_FILENAME_PATH"MultishotCapture"
+#define IMAGE_CAPTURE_THUMBNAIL_PATH TARGET_FILENAME_PATH"thumbnail.jpg"
+#define IMAGE_CAPTURE_SCREENNAIL_PATH TARGET_FILENAME_PATH"screennail.yuv"
+#define IMAGE_CAPTURE_EXIF_PATH TARGET_FILENAME_PATH"exif.raw"
+#define TARGET_FILENAME_VIDEO TARGET_FILENAME_PATH"test_rec_video.3gp"
+#define TARGET_FILENAME_AUDIO TARGET_FILENAME_PATH"test_rec_audio.amr"
#define CAPTURE_FILENAME_LEN 256
#define AUDIO_SOURCE_SAMPLERATE_AAC 44100
do { \
fprintf(stderr, MMF_DEBUG"[%s:%05d] " fmt "\n",__func__, __LINE__, ##arg); \
} while(0)
-
+
#define err_msg_t(fmt,arg...) \
do { \
fprintf(stderr, MMF_ERR"[%s:%05d] " fmt "\n",__func__, __LINE__, ##arg); \
* Enumerations for command
*/
#define SENSOR_WHITEBALANCE_NUM 10
-#define SENSOR_COLOR_TONE_NUM 37
+#define SENSOR_COLOR_TONE_NUM 30
#define SENSOR_FLIP_NUM 3
#define SENSOR_PROGRAM_MODE_NUM 15
#define SENSOR_FOCUS_NUM 6
/*-----------------------------------------------------------------------
| LOCAL CONSTANT DEFINITIONS: |
-----------------------------------------------------------------------*/
-enum
+enum
{
MODE_VIDEO_CAPTURE, /* recording and image capture mode */
- MODE_AUDIO, /* audio recording*/
- MODE_NUM,
+ MODE_AUDIO, /* audio recording*/
+ MODE_NUM,
};
enum
bool isMultishot; /* flag for multishot mode */
int stillshot_count; /* total stillshot count */
int multishot_count; /* total multishot count */
- char *stillshot_filename; /* stored filename of stillshot */
- char *multishot_filename; /* stored filename of multishot */
+ const char *stillshot_filename; /* stored filename of stillshot */
+ const char *multishot_filename; /* stored filename of multishot */
int menu_state;
int fps;
bool isMute;
typedef struct _cam_xypair
{
- char* attr_subcat_x;
- char* attr_subcat_y;
+ const char *attr_subcat_x;
+ const char *attr_subcat_y;
int x;
int y;
} cam_xypair_t;
---------------------------------------------------------------------------*/
static cam_handle_t *hcamcorder ;
-char *wb[SENSOR_WHITEBALANCE_NUM]={
+const char *wb[SENSOR_WHITEBALANCE_NUM]={
"None",
"Auto",
"Daylight",
"Cloudy",
- "Fluoroscent",
+ "Fluoroscent",
"Incandescent",
"Shade",
"Horizon",
"Custom",
};
-char *ct[SENSOR_COLOR_TONE_NUM] = {
+const char *ct[SENSOR_COLOR_TONE_NUM] = {
"NONE",
"MONO",
"SEPIA",
"SELECTVE_COLOR_RED_YELLOW",
};
-char *flip[SENSOR_FLIP_NUM] = {
+const char *flip[SENSOR_FLIP_NUM] = {
"Horizontal",
"Vertical",
"Not flipped",
};
-char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
+const char *program_mode[SENSOR_PROGRAM_MODE_NUM] = {
"NORMAL",
"PORTRAIT",
"LANDSCAPE",
"BACKLIGHT",
};
-char *focus_mode[SENSOR_FOCUS_NUM] = {
+const char *focus_mode[SENSOR_FOCUS_NUM] = {
"None",
"Pan",
"Auto",
"Continuous Auto",
};
-char *camera_rotation[SENSOR_INPUT_ROTATION] = {
+const char *camera_rotation[SENSOR_INPUT_ROTATION] = {
"None",
"90",
"180",
"270",
};
-char *af_scan[SENSOR_AF_SCAN_NUM] = {
+const char *af_scan[SENSOR_AF_SCAN_NUM] = {
"None",
"Normal",
"Macro mode",
"Full mode",
};
-char *iso_name[SENSOR_ISO_NUM] = {
+const char *iso_name[SENSOR_ISO_NUM] = {
"ISO Auto",
"ISO 50",
"ISO 100",
"ISO 3200",
};
-char *exposure_mode[SENSOR_EXPOSURE_NUM] = {
+const char *exposure_mode[SENSOR_EXPOSURE_NUM] = {
"AE off",
"AE all mode",
"AE center 1 mode",
"AE center 2 mode",
"AE center 3 mode",
- "AE spot 1 mode",
- "AE spot 2 mode",
+ "AE spot 1 mode",
+ "AE spot 2 mode",
"AE custom 1 mode",
"AE custom 2 mode",
};
-char *image_fmt[SENSOR_IMAGE_FORMAT] = {
+const char *image_fmt[SENSOR_IMAGE_FORMAT] = {
"NV12",
"NV12T",
"NV16",
"YV12",
};
-char *face_zoom_mode[] = {
+const char *face_zoom_mode[] = {
"Face Zoom OFF",
"Face Zoom ON",
};
-char *display_mode[] = {
+const char *display_mode[] = {
"Default",
"Primary Video ON and Secondary Video Full Screen",
"Primary Video OFF and Secondary Video Full Screen",
};
-char *output_mode[] = {
+const char *output_mode[] = {
"Letter Box mode",
"Original Size mode",
"Full Screen mode",
"ROI mode",
};
-char *rotate_mode[] = {
+const char *rotate_mode[] = {
"0",
"90",
"180",
"270",
};
-char* strobe_mode[] = {
+const char* strobe_mode[] = {
"Strobe OFF",
"Strobe ON",
"Strobe Auto",
"Strobe Permanent",
};
-char *detection_mode[2] = {
+const char *detection_mode[2] = {
"Face Detection OFF",
"Face Detection ON",
};
-char *wdr_mode[] = {
+const char *wdr_mode[] = {
"WDR OFF",
"WDR ON",
"WDR AUTO",
};
-char *hdr_mode[] = {
+const char *hdr_mode[] = {
"HDR OFF",
"HDR ON",
"HDR ON and Original",
};
-char *ahs_mode[] = {
+const char *ahs_mode[] = {
"Anti-handshake OFF",
"Anti-handshake ON",
"Anti-handshake AUTO",
"Anti-handshake MOVIE",
};
-char *vs_mode[] = {
+const char *vs_mode[] = {
"Video-stabilization OFF",
"Video-stabilization ON",
};
-char *visible_mode[] = {
+const char *visible_mode[] = {
"Display OFF",
- "Display ON",
+ "Display ON",
};
static gboolean msg_callback(int message, void *msg_param, void *user_param);
static gboolean init(int type);
static gboolean mode_change();
-int camcordertest_set_attr_int(char* attr_subcategory, int value);
+int camcordertest_set_attr_int(const char* attr_subcategory, int value);
static inline void flush_stdin()
cam_utils_convert_YUYV_to_UYVY(unsigned char* dst, unsigned char* src, gint length)
{
int i = 0;
-
+
//memset dst
memset(dst, 0x00, length);
memcpy(dst, src + 1, length-1);
}
}
+static void _file_write2(const char *path, void *data, int size)
+{
+ FILE *fp = NULL;
+
+ if (!path || !data || size <= 0) {
+ printf("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);
+ return;
+ } else {
+ printf("open success [%s]\n", path);
+ if (fwrite(data, size, 1, fp) != 1) {
+ printf("write error! errno %d\n", errno);
+ } else {
+ printf("write success [%s]\n", path);
+ }
+
+ fclose(fp);
+ fp = NULL;
+ }
+}
+
static int
camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCaptureDataType *thumb, void *data)
void *dst = NULL;
nret = _mmcamcorder_encode_jpeg(main->data, main->width, main->height, main->format,
- main->length, 90, &dst, &dst_size);
+ main->length, 90, &dst, &dst_size, 0);
if (nret) {
_file_write(m_filename, dst, dst_size);
} else {
/* thumbnail */
if (thumb != NULL) {
- _file_write(IMAGE_CAPTURE_THUMBNAIL_PATH, thumb->data, thumb->length);
+ _file_write2(IMAGE_CAPTURE_THUMBNAIL_PATH, thumb->data, thumb->length);
}
/* screennail */
"captured-screennail", &scrnl, &scrnl_size,
NULL);
if (scrnl != NULL) {
- _file_write(IMAGE_CAPTURE_SCREENNAIL_PATH, scrnl->data, scrnl->length);
+ _file_write2(IMAGE_CAPTURE_SCREENNAIL_PATH, scrnl->data, scrnl->length);
} else {
printf( "Screennail buffer is NULL.\n" );
}
"captured-exif-raw-data", &exif_data, &exif_size,
NULL);
if (exif_data) {
- _file_write(IMAGE_CAPTURE_EXIF_PATH, exif_data, exif_size);
+ _file_write2(IMAGE_CAPTURE_EXIF_PATH, exif_data, exif_size);
}
}
g_timer_reset(timer);
err = mm_camcorder_capture_start(hcamcorder->camcorder);
- if (err < 0)
- {
-// if(hcamcorder->isMultishot == TRUE)
-// hcamcorder->isMultishot = FALSE;
+ if (err < 0) {
warn_msg_t("Multishot mm_camcorder_capture_start = %x", err);
- }
+ }
+
return FALSE;
}
-int camcordertest_set_attr_int(char * attr_subcategory, int value)
+int camcordertest_set_attr_int(const char * attr_subcategory, int value)
{
char * err_attr_name = NULL;
int err;
char * err_attr_name = NULL;
int err;
- if (hcamcorder)
- {
- if (hcamcorder->camcorder)
- {
+ if (hcamcorder) {
+ if (hcamcorder->camcorder) {
debug_msg_t("camcordertest_set_attr_xypair((%s, %s), (%d, %d))", pair.attr_subcat_x, pair.attr_subcat_y, pair.x, pair.y);
err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
pair.attr_subcat_x, pair.x,
pair.attr_subcat_y, pair.y,
NULL);
- if (err < 0)
- {
+ if (err < 0) {
err_msg_t("camcordertest_set_attr_xypair : Error(%s:%x)!!", err_attr_name, err);
SAFE_FREE (err_attr_name);
return FALSE;
return FALSE;
}
-int camcordertest_get_attr_valid_intarray(char * attr_name, int ** array, int *count)
+int camcordertest_get_attr_valid_intarray(const char * attr_name, int ** array, int *count)
{
MMCamAttrsInfo info;
int err;
return FALSE;
}
-int camcordertest_get_attr_valid_intrange(char * attr_name, int *min, int *max)
+int camcordertest_get_attr_valid_intrange(const char * attr_name, int *min, int *max)
{
MMCamAttrsInfo info;
int err;
g_print("\t Video Capture > Setting\n");
g_print("\t=======================================\n");
g_print("\t >>>>>>>>>>>>>>>>>>>>>>>>>>>> [Camera] \n");
+ g_print("\t '0' Preview resolution \n");
g_print("\t '1' Capture resolution \n");
g_print("\t '2' Digital zoom level \n");
g_print("\t '3' Optical zoom level \n");
g_print("\t 'K' Video-stabilization \n");
g_print("\t 'u' Touch AF area \n");
g_print("\t 'm' Stream callback function \n");
+ g_print("\t 'M' Camcorder Motion Rate setting \n");
g_print("\t 'b' back\n");
g_print("\t=======================================\n");
break;
static void setting_menu(gchar buf)
{
gboolean bret = FALSE;
- int index=0;
+ int idx = 0;
int min = 0;
int max = 0;
int width_count = 0;
if (hcamcorder->mode == MODE_VIDEO_CAPTURE) {
switch (buf) {
/* Camera setting */
+ case '0': // Setting > Preview Resolution setting
+ g_print("*Select the preview resolution!\n");
+ camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_WIDTH, &width_array, &width_count);
+ camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_HEIGHT, &height_array, &height_count);
+
+ if(width_count != height_count) {
+ err_msg_t("System has wrong information!!\n");
+ } else if (width_count == 0) {
+ g_print("Not supported!!\n");
+ } else {
+ flush_stdin();
+
+ for ( i = 0; i < width_count; i++) {
+ g_print("\t %d. %d*%d\n", i+1, width_array[i], height_array[i]);
+ }
+ err = scanf("%d",&idx);
+ if (err == EOF) {
+ printf("\nscanf error : errno %d\n", errno);
+ } else {
+ if( idx > 0 && idx <= width_count ) {
+ //Set capture size first
+ input_pair.attr_subcat_x = MMCAM_CAMERA_WIDTH;
+ input_pair.attr_subcat_y = MMCAM_CAMERA_HEIGHT;
+ input_pair.x = width_array[idx-1];
+ input_pair.y = height_array[idx-1];
+ bret = camcordertest_set_attr_xypair(input_pair);
+ }
+ }
+ }
+ break;
case '1' : // Setting > Capture Resolution setting
/* check recommend preview resolution */
camcordertest_get_attr_valid_intarray(MMCAM_RECOMMEND_CAMERA_WIDTH, &width_array, &width_count);
g_print("MMCAM_RECOMMEND_CAMERA_WIDTH/HEIGHT Not supported!!\n");
} else {
g_print("\n - MMCAM_RECOMMEND_CAMERA_WIDTH and HEIGHT (count %d) -\n", width_count);
- g_print("\t NORMAL ratio : %dx%d\n",
- width_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL], height_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL]);
- if (width_count >= 2) {
- g_print("\t WIDE ratio : %dx%d\n\n",
- width_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE], height_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE]);
- } else {
- g_print("\t There is ONLY NORMAL resolution\n\n");
+ if (width_count > 0) {
+ g_print("\t NORMAL ratio : %dx%d\n", width_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL], height_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL]);
+ }
+ if (width_count > 1) {
+ g_print("\t WIDE ratio : %dx%d\n", width_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE], height_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE]);
+ }
+ if (width_count > 2) {
+ g_print("\t SQUARE ratio : %dx%d\n", width_array[MM_CAMCORDER_PREVIEW_TYPE_SQUARE], height_array[MM_CAMCORDER_PREVIEW_TYPE_SQUARE]);
}
}
for ( i = 0; i < width_count; i++) {
g_print("\t %d. %d*%d\n", i+1, width_array[i], height_array[i]);
}
- err = scanf("%d",&index);
+ err = scanf("%d",&idx);
if (err == EOF) {
printf("\nscanf error : errno %d\n", errno);
} else {
- if( index > 0 && index <= width_count ) {
+ if( idx > 0 && idx <= width_count ) {
//Set capture size first
input_pair.attr_subcat_x = "capture-width";
input_pair.attr_subcat_y = "capture-height";
- input_pair.x = width_array[index-1];
- input_pair.y = height_array[index-1];
+ input_pair.x = width_array[idx-1];
+ input_pair.y = height_array[idx-1];
bret = camcordertest_set_attr_xypair(input_pair);
}
}
} else {
flush_stdin();
g_print("\n Select Digital zoom level (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-digital-zoom", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-digital-zoom", idx);
}
break;
} else {
flush_stdin();
g_print("\n Select Optical zoom level (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-optical-zoom", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-optical-zoom", idx);
}
break;
g_print("\t2. AF Stop !\n\n");
flush_stdin();
- err = scanf("%d", &index);
+ err = scanf("%d", &idx);
- switch (index) {
+ switch (idx) {
case 0:
{
g_print("*Focus mode !\n");
for (i = 0 ; i < count ; i++) {
g_print("\t %d. %s\n", array[i], focus_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-focus-mode", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-focus-mode", idx);
}
}
break;
mm_camcorder_stop_focusing(hcamcorder->camcorder);
break;
default:
- g_print("Wrong Input[%d] !! \n", index);
+ g_print("Wrong Input[%d] !! \n", idx);
break;
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], af_scan[array[i]]);
}
- err = scanf("%d",&index);
- camcordertest_set_attr_int("camera-af-scan-range", index);
+ err = scanf("%d",&idx);
+ camcordertest_set_attr_int("camera-af-scan-range", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], exposure_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-exposure-mode", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-exposure-mode", idx);
}
break;
} else {
flush_stdin();
g_print("\n Select Exposure value(%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-exposure-value", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-exposure-value", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %d \n", i+1, array[i]);
}
- err = scanf("%d",&index);
+ err = scanf("%d",&idx);
- if( index > 0 && index <= count ) {
- bret = camcordertest_set_attr_int("camera-shutter-speed", array[index-1]);
+ if( idx > 0 && idx <= count ) {
+ bret = camcordertest_set_attr_int("camera-shutter-speed", array[idx-1]);
}
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], iso_name[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-iso", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-iso", idx);
}
break;
for (i = min ; i <= max ; i++) {
g_print("\t %d. %s\n", i, camera_rotation[i]);
}
- err = scanf("%d",&index);
+ err = scanf("%d",&idx);
CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
- bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index);
+ bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, idx);
CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
}
break;
g_print(" 2. Flip VERTICAL\n");
g_print(" 3. Flip BOTH\n");
- err = scanf("%d", &index);
+ err = scanf("%d", &idx);
CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
- camcordertest_set_attr_int(MMCAM_CAMERA_FLIP, index);
+ camcordertest_set_attr_int(MMCAM_CAMERA_FLIP, idx);
CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder));
} else {
flush_stdin();
g_print("\n Select Jpeg quality (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("image-encoder-quality", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("image-encoder-quality", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], image_fmt[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-format", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-format", idx);
CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder));
CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder));
CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder));
g_print("\t 8. LEFT_BOTTOM\n");
flush_stdin();
- err = scanf("%d", &index);
+ err = scanf("%d", &idx);
- if (index < 1 || index > 8) {
- g_print("Wrong INPUT[%d]!! \n", index);
+ if (idx < 1 || idx > 8) {
+ g_print("Wrong INPUT[%d]!! \n", idx);
} else {
- camcordertest_set_attr_int(MMCAM_TAG_ORIENTATION, index);
+ camcordertest_set_attr_int(MMCAM_TAG_ORIENTATION, idx);
}
break;
for (i = 0 ; i < count ; i++) {
g_print("\t %d. %s\n", array[i], display_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, idx);
}
break;
for( i = min ; i <= max ; i++ ) {
g_print( "%d. %s\n", i, output_mode[i] );
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("display-geometry-method", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("display-geometry-method", idx);
}
break;
flush_stdin();
g_print("\n Select Rotate mode(%d ~ %d)\n", min, max);
g_print("\t0. 0\n\t1. 90\n\t2. 180\n\t3. 270\n\n");
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, idx);
}
break;
flush_stdin();
g_print("\n Select Rotate mode(%d ~ %d)\n", min, max);
g_print("\t0. NONE\n\t1. HORIZONTAL\n\t2. VERTICAL\n\t3. BOTH\n\n");
- err = scanf("%d",&index);
- camcordertest_set_attr_int(MMCAM_DISPLAY_FLIP, index);
+ err = scanf("%d",&idx);
+ camcordertest_set_attr_int(MMCAM_DISPLAY_FLIP, idx);
break;
case 'g' : // Setting > Brightness
} else {
flush_stdin();
g_print("\n Select brightness (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-brightness", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-brightness", idx);
}
break;
} else {
flush_stdin();
g_print("\n Select Contrast (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-contrast", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-contrast", idx);
}
break;
} else {
flush_stdin();
g_print("\n Select Saturation (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-saturation", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-saturation", idx);
}
break;
} else {
flush_stdin();
g_print("\n Select Hue (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-hue", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-hue", idx);
}
break;
} else {
flush_stdin();
g_print("\n Select Sharpness (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-sharpness", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-sharpness", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], wb[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-wb", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-wb", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], ct[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-color-tone", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-color-tone", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], wdr_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("camera-wdr", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("camera-wdr", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], program_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("filter-scene-mode", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("filter-scene-mode", idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], strobe_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int("strobe-mode", index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int("strobe-mode", idx);
}
break;
g_print("*Select Capture mode!\n");
flush_stdin();
g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode\n\t3. HDR capture\n");
- err = scanf("%d",&index);
+ err = scanf("%d",&idx);
- switch (index) {
+ switch (idx) {
case 1:
g_print("stillshot mode selected and capture callback is set!!!!\n");
hcamcorder->isMultishot = FALSE;
camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, 0);
- index = 0;
+ idx = 0;
min = 0;
max = 0;
flush_stdin();
//g_print("\n Check Point!!! [Change resolution to 800x480]\n");
g_print("Select mulitshot number (%d ~ %d)\n", min, max);
- err = scanf("%d",&index);
- if( index >= min && index <= max ) {
- multishot_num = index;
+ err = scanf("%d",&idx);
+ if( idx >= min && idx <= max ) {
+ multishot_num = idx;
mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
MMCAM_CAPTURE_COUNT, multishot_num,
NULL);
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], hdr_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, idx);
}
break;
default:
for ( i = 0; i < count; i++) {
g_print("\t %d. %s \n", array[i], detection_mode[array[i]]);
}
- err = scanf("%d",&index);
+ err = scanf("%d",&idx);
- if( index >= 0 && index < count ) {
- bret = camcordertest_set_attr_int("detect-mode", array[index]);
+ if( idx >= 0 && idx < count ) {
+ bret = camcordertest_set_attr_int("detect-mode", array[idx]);
} else {
g_print("Wrong input value. Try again!!\n");
bret = FALSE;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], ahs_mode[array[i]]);
}
- err = scanf("%d",&index);
- bret = camcordertest_set_attr_int(MMCAM_CAMERA_ANTI_HANDSHAKE, index);
+ err = scanf("%d",&idx);
+ bret = camcordertest_set_attr_int(MMCAM_CAMERA_ANTI_HANDSHAKE, idx);
}
break;
for ( i = 0; i < count; i++) {
g_print("\t %d. %s\n", array[i], vs_mode[array[i]]);
}
- err = scanf("%d",&index);
+ err = scanf("%d",&idx);
- if (index == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
+ if (idx == MM_CAMCORDER_VIDEO_STABILIZATION_ON) {
g_print("\n Restart preview with NV12 and 720p resolution\n");
err = mm_camcorder_stop(hcamcorder->camcorder);
input_pair.y = 720;
camcordertest_set_attr_xypair(input_pair);
camcordertest_set_attr_int(MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_NV12);
- camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, index);
+ camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, idx);
if (err == MM_ERROR_NONE) {
err = mm_camcorder_realize(hcamcorder->camcorder);
g_print("\n Restart FAILED! %x\n", err);
}
} else {
- camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, index);
+ camcordertest_set_attr_int(MMCAM_CAMERA_VIDEO_STABILIZATION, idx);
}
}
break;
g_print("\t 1. Set Video Stream Callback \n");
g_print("\t 2. Unset Video Stream Callback \n");
flush_stdin();
- err = scanf("%d", &index);
- if(index == 1) {
+ err = scanf("%d", &idx);
+ if(idx == 1) {
video_stream_cb_cnt = 0;
error_num = mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, (mm_camcorder_video_stream_callback)camcordertest_video_stream_cb, (void*)hcamcorder->camcorder);
if( error_num == MM_ERROR_NONE ) {
} else {
g_print("\n Setting Failure\n");
}
- } else if(index == 2) {
+ } else if(idx == 2) {
mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, NULL, (void*)hcamcorder->camcorder);
video_stream_cb_cnt = 0;
audio_stream_cb_cnt = 0;
}
break;
+ case 'M':
+ {
+ float motion_rate = 0.0;
+
+ flush_stdin();
+
+ g_print("*Camcorder Motion Rate setting! (should be bigger than zero)\n");
+
+ err = scanf("%f", &motion_rate);
+ err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name,
+ MMCAM_CAMERA_RECORDING_MOTION_RATE, motion_rate,
+ 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;
+ } else {
+ g_print("Succeed to set Motion Rate %f\n", motion_rate);
+ }
+ }
+ break;
+
case 'b' : // back
hcamcorder->menu_state = MENU_STATE_MAIN;
break;
g_print("\t Invalid mode, back to upper menu \n");
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);
}
*/
static gboolean cmd_input(GIOChannel *channel)
{
- gchar buf[256];
- gsize read;
+ gchar *buf = NULL;
+ gsize read_size;
+ GError *g_error = NULL;
debug_msg_t("ENTER");
- g_io_channel_read(channel, buf, CAPTURE_FILENAME_LEN, &read);
- buf[read] = '\0';
- g_strstrip(buf);
+ g_io_channel_read_line(channel, &buf, &read_size, NULL, &g_error);
+ if (g_error) {
+ debug_msg_t("g_io_channel_read_chars error");
+ g_error_free(g_error);
+ g_error = NULL;
+ }
- debug_msg_t("Menu Status : %d", hcamcorder->menu_state);
- switch(hcamcorder->menu_state)
- {
- case MENU_STATE_MAIN:
- main_menu(buf[0]);
- break;
- case MENU_STATE_SETTING:
- setting_menu(buf[0]);
- break;
- default:
- break;
+ if (buf) {
+ g_strstrip(buf);
+
+ debug_msg_t("Menu Status : %d", hcamcorder->menu_state);
+ switch(hcamcorder->menu_state)
+ {
+ case MENU_STATE_MAIN:
+ main_menu(buf[0]);
+ break;
+ case MENU_STATE_SETTING:
+ setting_menu(buf[0]);
+ break;
+ default:
+ break;
+ }
+
+ g_free(buf);
+ buf = NULL;
+
+ print_menu();
+ } else {
+ debug_msg_t("No read input");
}
- print_menu();
+
return TRUE;
}
int err;
int size;
int preview_format = MM_PIXEL_FORMAT_NV12;
+ int support_zero_copy_format = 0;
+ int support_media_packet_preview_cb = 0;
MMHandleType cam_handle = 0;
char *err_attr_name = NULL;
if (type == MODE_VIDEO_CAPTURE) {
mm_camcorder_get_attributes((MMHandleType)cam_handle, NULL,
MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, &preview_format,
+ MMCAM_SUPPORT_ZERO_COPY_FORMAT, &support_zero_copy_format,
+ MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &support_media_packet_preview_cb,
NULL);
+ warn_msg_t("MMCAM_SUPPORT_ZERO_COPY_FORMAT %d", support_zero_copy_format);
+ warn_msg_t("MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB %d", support_media_packet_preview_cb);
+
/* camcorder attribute setting */
err = mm_camcorder_set_attributes( (MMHandleType)cam_handle, &err_attr_name,
MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO_CAPTURE,
MMCAM_TAG_LATITUDE, 35.3036944,
MMCAM_TAG_LONGITUDE, 176.67837,
MMCAM_TAG_ALTITUDE, 190.3455,
- MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X,
- MMCAM_DISPLAY_RECT_X, DISPLAY_X_0,
- MMCAM_DISPLAY_RECT_Y, DISPLAY_Y_0,
- MMCAM_DISPLAY_RECT_WIDTH, 480,
- MMCAM_DISPLAY_RECT_HEIGHT, 640,
- MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
- //MMCAM_DISPLAY_FLIP, MM_FLIP_HORIZONTAL,
MMCAM_DISPLAY_GEOMETRY_METHOD, MM_DISPLAY_METHOD_LETTER_BOX,
MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL,
- "capture-thumbnail", TRUE,
"tag-gps-time-stamp", 72815.5436243543,
"tag-gps-date-stamp", "2010:09:20", 10,
"tag-gps-processing-method", "GPS NETWORK HYBRID ARE ALL FINE.", 32,
//MMCAM_AUDIO_DISABLE, TRUE,
MMCAM_TARGET_FILENAME, TARGET_FILENAME_VIDEO, strlen(TARGET_FILENAME_VIDEO),
//MMCAM_TARGET_TIME_LIMIT, 360000,
-#ifndef _TIZEN_PUBLIC_
//MMCAM_TARGET_MAX_SIZE, 102400,
-#endif /* _TIZEN_PUBLIC_ */
NULL );
if (err != MM_ERROR_NONE) {
err = mm_camcorder_set_attributes( hcamcorder->camcorder, &err_attr_name,
MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
- MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AMR,
- MMCAM_FILE_FORMAT, MM_FILE_FORMAT_AMR,
- MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AMR,
+ MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
+ MMCAM_FILE_FORMAT, MM_FILE_FORMAT_MP4,
+ MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AAC,
MMCAM_AUDIO_FORMAT, AUDIO_SOURCE_FORMAT,
MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AAC,
MMCAM_TARGET_FILENAME, TARGET_FILENAME_AUDIO, size,
MMCAM_TARGET_TIME_LIMIT, 360000,
MMCAM_AUDIO_ENCODER_BITRATE, 12200,
-#ifndef _TIZEN_PUBLIC_
MMCAM_TARGET_MAX_SIZE, 300,
-#endif /* _TIZEN_PUBLIC_ */
NULL);
-
+
if (err < 0) {
warn_msg_t("Init fail. (%s:%x)", err_attr_name, err);
SAFE_FREE (err_attr_name);
debug_msg_t("Init DONE.");
return TRUE;
-
+
ERROR:
err_msg_t("init failed.");
return FALSE;
/**
* This function is to represent messagecallback
*
- * @param message [in] Specifies the message
+ * @param message [in] Specifies the message
* @param param [in] Specifies the message type
* @param user_param [in] Specifies the user poiner for passing to callback function
* @return This function returns TRUE/FALSE
{
MMMessageParamType *param = (MMMessageParamType *) msg_param;
-
+
switch (message) {
case MM_MESSAGE_CAMCORDER_ERROR:
g_print("MM_MESSAGE_ERROR : code = %x", param->code);
debug_msg_t("Camcorder State is [NULL]");
break;
case MM_CAMCORDER_STATE_READY :
- mmcamcorder_state = MM_CAMCORDER_STATE_READY;
+ mmcamcorder_state = MM_CAMCORDER_STATE_READY;
debug_msg_t("Camcorder State is [READY]");
break;
case MM_CAMCORDER_STATE_PREPARE :
mmcamcorder_state = MM_CAMCORDER_STATE_PAUSED;
debug_msg_t("Camcorder State is [PAUSED]");
break;
+ default:
+ debug_msg_t("Unknown State [%d]", g_current_state);
+ break;
}
break;
hour, minute, second, param->recording_status.remained_time, param->recording_status.filesize);
}
}
- break;
- case MM_MESSAGE_CAMCORDER_MAX_SIZE:
- {
+ break;
+ case MM_MESSAGE_CAMCORDER_MAX_SIZE:
+ {
int err;
g_print("*Save Recording because receives message : MM_MESSAGE_CAMCORDER_MAX_SIZE\n");
g_timer_reset(timer);
err = mm_camcorder_commit(hcamcorder->camcorder);
- if (err < 0)
+ if (err < 0)
{
warn_msg_t("Save recording mm_camcorder_commit = %x", err);
// goto ERROR;
case MM_MESSAGE_CAMCORDER_CURRENT_VOLUME:
break;
case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE:
- {
+ {
int err;
g_print("*Save Recording because receives message : MM_MESSAGE_CAMCORDER_NO_FREE_SPACE\n");
g_timer_reset(timer);
err = mm_camcorder_commit(hcamcorder->camcorder);
- if (err < 0)
+ if (err < 0)
{
warn_msg_t("Save recording mm_camcorder_commit = %x", err);
// goto ERROR;
break;
case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO:
{
- static int info_count = 0;
MMCamFaceDetectInfo *cam_fd_info = NULL;
cam_fd_info = (MMCamFaceDetectInfo *)(param->data);
cam_fd_info->face_info[i].rect.width,
cam_fd_info->face_info[i].rect.height);
}
-
- if (info_count == 0) {
- mm_camcorder_set_attributes(hcamcorder->camcorder, NULL,
- MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_ON,
- MMCAM_CAMERA_FACE_ZOOM_X, cam_fd_info->face_info[0].rect.x + (cam_fd_info->face_info[0].rect.width>>1),
- MMCAM_CAMERA_FACE_ZOOM_Y, cam_fd_info->face_info[0].rect.y + (cam_fd_info->face_info[0].rect.height>>1),
- MMCAM_CAMERA_FACE_ZOOM_LEVEL, 0,
- NULL);
- info_count = 1;
- g_print("\n\t##### START FACE ZOOM [%d,%d] #####\n", cam_fd_info->face_info[0].rect.x, cam_fd_info->face_info[0].rect.y);
- } else if (info_count++ == 90) {
- mm_camcorder_set_attributes(hcamcorder->camcorder, NULL,
- MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_OFF,
- NULL);
- g_print("\n\t##### STOP FACE ZOOM #####\n");
- info_count = -60;
- }
}
}
break;
hcamcorder->isMultishot = FALSE;
hcamcorder->stillshot_count = 0; /* total stillshot count */
hcamcorder->multishot_count = 0; /* total multishot count */
- hcamcorder->stillshot_filename = STILL_CAPTURE_FILE_PATH_NAME; /* stored filename of stillshot */
- hcamcorder->multishot_filename = MULTI_CAPTURE_FILE_PATH_NAME; /* stored filename of multishot */
+ hcamcorder->stillshot_filename = STILL_CAPTURE_FILE_PATH_NAME; /* stored filename of stillshot */
+ hcamcorder->multishot_filename = MULTI_CAPTURE_FILE_PATH_NAME; /* stored filename of multishot */
hcamcorder->menu_state = MENU_STATE_MAIN;
hcamcorder->isMute = FALSE;
hcamcorder->elapsed_time = 0;
debug_msg_t("mm_camcorder_cancel");
err = mm_camcorder_cancel(hcamcorder->camcorder);
- if (err < 0)
+ if (err < 0)
{
warn_msg_t("exit mm_camcorder_cancel = %x", err);
return FALSE;
debug_msg_t("mm_camcorder_capture_stop");
err = mm_camcorder_capture_stop(hcamcorder->camcorder);
- if (err < 0)
+ if (err < 0)
{
warn_msg_t("exit mmcamcorder_capture_stop = %x", err);
return FALSE;
debug_msg_t("mm_camcorder_stop");
mm_camcorder_stop(hcamcorder->camcorder);
}
-
+
err = mm_camcorder_get_state(hcamcorder->camcorder, (MMCamcorderStateType *)&state);
if(state == MM_CAMCORDER_STATE_READY)
{
debug_msg_t("mm_camcorder_unrealize");
mm_camcorder_unrealize(hcamcorder->camcorder);
}
-
+
err = mm_camcorder_get_state(hcamcorder->camcorder, (MMCamcorderStateType *)&state);
if(state == MM_CAMCORDER_STATE_NULL)
- {
+ {
debug_msg_t("mm_camcorder_destroy");
mm_camcorder_destroy(hcamcorder->camcorder);
mmcamcorder_state = MM_CAMCORDER_STATE_NONE;
}
}
-
+
init_handle();
mmcamcorder_print_state = MM_CAMCORDER_STATE_PREPARE;
while(!check) {
g_print("\t 'q' Exit\n");
g_print("\t=======================================\n");
- g_print("\t Enter the media type:\n\t");
+ g_print("\t Enter the media type:\n\t");
err = scanf("%c", &media_type);
-
+
switch (media_type) {
case '1':
hcamcorder->mode= MODE_VIDEO_CAPTURE;
return -1;
}
- g_get_current_time(¤t);
+ g_get_current_time(¤t);
timersub(¤t, &previous, &result);
time_msg_t("Camera Starting Time : %ld.%lds", result.tv_sec, result.tv_usec);
/**
* This function is the example main function for mmcamcorder API.
*
- * @param
+ * @param
*
* @return This function returns 0.
* @remark
{
int bret;
- if (!g_thread_supported())
- g_thread_init (NULL);
-
timer = g_timer_new();
gst_init(&argc, &argv);