/*=======================================================================================
| INCLUDE FILES |
========================================================================================*/
+#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_buffer_probe(x_pad, G_CALLBACK(x_callback), x_hcamcorder); \
+ 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_event_probe(x_pad, G_CALLBACK(x_callback), x_hcamcorder); \
+ 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_data_probe(x_pad, G_CALLBACK(x_callback), x_hcamcorder); \
- 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; \
item->handler_id = g_signal_connect(G_OBJECT(x_object), x_signal,\
G_CALLBACK(x_callback), x_hcamcorder ); \
x_hcamcorder->signals = g_list_append(x_hcamcorder->signals, item); \
- _mmcam_dbg_log("Connecting signal on [%s] - [ID : %lu], [Category : %x] ", GST_OBJECT_NAME(item->object), item->handler_id, item->category); \
+ _mmcam_dbg_log("Connecting signal on [%s][%p] - [ID : %lu], [Category : %x] ", GST_OBJECT_NAME(item->object), item->object, item->handler_id, item->category); \
} \
} while (0);
#define MMCAMCORDER_G_OBJECT_SET(obj, name, value) \
do { \
if (obj) { \
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
+ GParamSpec *spec = g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name);\
+ if(spec) { \
+ if (spec->value_type == G_TYPE_INT64) {\
+ g_object_set(G_OBJECT(obj), name, (gint64)value, NULL); \
+ } else if (spec->value_type == G_TYPE_UINT64) { \
+ g_object_set(G_OBJECT(obj), name, (guint64)value, NULL); \
+ } else if (spec->value_type == G_TYPE_FLOAT) { \
+ g_object_set(G_OBJECT(obj), name, (float)value, NULL); \
+ } else if (spec->value_type == G_TYPE_DOUBLE) { \
+ g_object_set(G_OBJECT(obj), name, (double)value, NULL); \
+ } else { \
+ g_object_set(G_OBJECT(obj), name, value, NULL); \
+ } \
+ } else { \
+ _mmcam_dbg_warn ("The object doesn't have a property named(%s)", name); \
+ } \
+ } else { \
+ _mmcam_dbg_err("Null object"); \
+ } \
+} while(0);
+
+#define MMCAMCORDER_G_OBJECT_SET_POINTER(obj, name, value) \
+do { \
+ if (obj) { \
+ GParamSpec *spec = g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name);\
+ if(spec) { \
g_object_set(G_OBJECT(obj), name, value, NULL); \
} else { \
_mmcam_dbg_warn ("The object doesn't have a property named(%s)", name); \
((gchar)(((fourcc)>>16)&0xff)), \
((gchar)(((fourcc)>>24)&0xff))
+#define MMCAM_SEND_MESSAGE(handle, msg_id, msg_code) \
+{\
+ _MMCamcorderMsgItem msg;\
+ msg.id = msg_id;\
+ msg.param.code = msg_code;\
+ _mmcam_dbg_log("msg id : %x, code : %x", msg_id, msg_code);\
+ _mmcamcorder_send_message((MMHandleType)handle, &msg);\
+}
+
+
/*=======================================================================================
| ENUM DEFINITIONS |
========================================================================================*/
MMHandleType handle; /**< handle */
int id; /**< message id */
MMMessageParamType param; /**< message parameter */
+ pthread_mutex_t lock; /**< mutex for item */
} _MMCamcorderMsgItem;
+
/*=======================================================================================
| 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)
+#define G_DBUS_REPLY_TIMEOUT (120 * 1000)
/*=======================================================================================
| GLOBAL FUNCTION PROTOTYPES |
========================================================================================*/
/* 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);
gboolean _mmcamcorder_link_elements(GList *element_list);
/* Message */
-gboolean _mmcamcroder_msg_callback(void *data);
-gboolean _mmcamcroder_send_message(MMHandleType handle, _MMCamcorderMsgItem *data);
-void _mmcamcroder_remove_message_all(MMHandleType handle);
+#ifdef _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK
+gboolean _mmcamcorder_msg_callback(void *data);
+#endif /* _MMCAMCORDER_ENABLE_IDLE_MESSAGE_CALLBACK */
+gboolean _mmcamcorder_send_message(MMHandleType handle, _MMCamcorderMsgItem *data);
+void _mmcamcorder_remove_message_all(MMHandleType handle);
/* Pixel format */
-int _mmcamcorder_get_pixel_format(GstBuffer *buffer);
+int _mmcamcorder_get_pixel_format(GstCaps *pad);
int _mmcamcorder_get_pixtype(unsigned int fourcc);
unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_copy_format);
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);
+/* resize */
+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.
tag_fourcc is Four-character-code (FOURCC) */
-gint _mmcamcorder_find_tag(FILE *f, guint32 tag_fourcc);
+gint _mmcamcorder_find_tag(FILE *f, guint32 tag_fourcc, gboolean do_rewind);
+gboolean _mmcamcorder_find_fourcc(FILE *f, guint32 tag_fourcc, gboolean do_rewind);
gint32 _mmcamcorder_double_to_fix(gdouble d_number);
gboolean _mmcamcorder_update_size(FILE *f, gint64 prev_pos, gint64 curr_pos);
gboolean _mmcamcorder_write_loci(FILE *f, _MMCamcorderLocationInfo info);
-gboolean _mmcamcorder_write_udta(FILE *f, _MMCamcorderLocationInfo info);
-gulong _mmcamcorder_get_container_size(const guchar *size);
+gboolean _mmcamcorder_write_geodata(FILE *f,_MMCamcorderLocationInfo info);
+gboolean _mmcamcorder_write_udta(FILE *f, int gps_enable, _MMCamcorderLocationInfo info, _MMCamcorderLocationInfo geotag);
+guint64 _mmcamcorder_get_container_size(const guchar *size);
+guint64 _mmcamcorder_get_container_size64(const guchar *size);
+gboolean _mmcamcorder_update_composition_matrix(FILE *f, int orientation);
/* File system */
-int _mmcamcorder_get_freespace(const gchar *path, guint64 *free_space);
+int _mmcamcorder_get_freespace(const gchar *path, const gchar *root_directory, 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);
+
+/* Task */
+void *_mmcamcorder_util_task_thread_func(void *data);
-/* Debug */
-void _mmcamcorder_err_trace_write(char *str_filename, char *func_name, int line_num, char *fmt, ...);
+/* device */
+int _mmcamcorder_get_device_flash_brightness(int *brightness);
#ifdef __cplusplus
}